diff --git a/tests/baselines/reference/ES5For-of30.errors.txt b/tests/baselines/reference/ES5For-of30.errors.txt index ee2d14a4f58..e99b8284bf3 100644 --- a/tests/baselines/reference/ES5For-of30.errors.txt +++ b/tests/baselines/reference/ES5For-of30.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'number | string' is not an array type. +tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type. tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'. @@ -8,7 +8,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error var tuple: [number, string] = [2, "3"]; for ([a = 1, b = ""] of tuple) { ~~~~~~~~~~~~~~~ -!!! error TS2461: Type 'number | string' is not an array type. +!!! error TS2461: Type 'string | number' is not an array type. ~ !!! error TS2322: Type 'number' is not assignable to type 'string'. ~ diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt index 57a28b6612c..635bb09616a 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt +++ b/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'number | string' is not assignable to type 'string'. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -7,5 +7,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6) var v: string; for (v of union) { } ~ -!!! error TS2322: Type 'number | string' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.types b/tests/baselines/reference/ES5For-ofTypeCheck5.types index f24aa54c7f3..ed3d13f3918 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck5.types +++ b/tests/baselines/reference/ES5For-ofTypeCheck5.types @@ -3,6 +3,6 @@ var union: string | number[]; >union : string | number[] for (var v of union) { } ->v : number | string +>v : string | number >union : string | number[] diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt index 3f382d72a08..156eb188803 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt +++ b/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'string[] | number | symbol' is not an array type. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'number | symbol | string[]' is not an array type. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts (1 errors) ==== var union: string | string[] | number | symbol; for (let v of union) { } ~~~~~ -!!! error TS2461: Type 'string[] | number | symbol' is not an array type. \ No newline at end of file +!!! error TS2461: Type 'number | symbol | string[]' is not an array type. \ No newline at end of file diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.types b/tests/baselines/reference/TypeGuardWithEnumUnion.types index bf5625e0c99..dee8feae27d 100644 --- a/tests/baselines/reference/TypeGuardWithEnumUnion.types +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.types @@ -6,14 +6,14 @@ enum Color { R, G, B } >B : Color function f1(x: Color | string) { ->f1 : (x: Color | string) => void ->x : Color | string +>f1 : (x: string | Color) => void +>x : string | Color >Color : Color if (typeof x === "number") { >typeof x === "number" : boolean >typeof x : string ->x : Color | string +>x : string | Color >"number" : "number" var y = x; @@ -35,14 +35,14 @@ function f1(x: Color | string) { } function f2(x: Color | string | string[]) { ->f2 : (x: Color | string | string[]) => void ->x : Color | string | string[] +>f2 : (x: string | Color | string[]) => void +>x : string | Color | string[] >Color : Color if (typeof x === "object") { >typeof x === "object" : boolean >typeof x : string ->x : Color | string | string[] +>x : string | Color | string[] >"object" : "object" var y = x; @@ -55,7 +55,7 @@ function f2(x: Color | string | string[]) { if (typeof x === "number") { >typeof x === "number" : boolean >typeof x : string ->x : string[] | Color | string +>x : string | Color | string[] >"number" : "number" var z = x; @@ -68,16 +68,16 @@ function f2(x: Color | string | string[]) { } else { var w = x; ->w : string[] | string ->x : string[] | string +>w : string | string[] +>x : string | string[] var w: string | string[]; ->w : string[] | string +>w : string | string[] } if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : Color | string[] | string +>x : string | Color | string[] >"string" : "string" var a = x; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types index c43b7889cc5..0fcf3c3590d 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -34,7 +34,7 @@ var d2: IHasVisualizationModel = i || moduleA; var d2: IHasVisualizationModel = moduleA || i; >d2 : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel ->moduleA || i : typeof moduleA +>moduleA || i : IHasVisualizationModel >moduleA : typeof moduleA >i : IHasVisualizationModel diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index fca66793f40..2e87dc2ca15 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -366,22 +366,22 @@ module EmptyTypes { >base2 : typeof base2 var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : base[] ->[baseObj, base2Obj, ifaceObj] : base[] +>b1 : iface[] +>[baseObj, base2Obj, ifaceObj] : iface[] >baseObj : base >base2Obj : base2 >ifaceObj : iface var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : base2[] ->[base2Obj, baseObj, ifaceObj] : base2[] +>b2 : iface[] +>[base2Obj, baseObj, ifaceObj] : iface[] >base2Obj : base2 >baseObj : base >ifaceObj : iface var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : base[] ->[baseObj, ifaceObj, base2Obj] : base[] +>b3 : iface[] +>[baseObj, ifaceObj, base2Obj] : iface[] >baseObj : base >ifaceObj : iface >base2Obj : base2 diff --git a/tests/baselines/reference/arrayLiteralComments.types b/tests/baselines/reference/arrayLiteralComments.types index a8c32b48e41..e1863516792 100644 --- a/tests/baselines/reference/arrayLiteralComments.types +++ b/tests/baselines/reference/arrayLiteralComments.types @@ -1,7 +1,7 @@ === tests/cases/compiler/arrayLiteralComments.ts === var testArrayWithFunc = [ ->testArrayWithFunc : ((() => void) | string | number | { a: number; } | number[])[] ->[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : ((() => void) | string | number | { a: number; } | number[])[] +>testArrayWithFunc : (string | number | (() => void) | number[] | { a: number; })[] +>[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : (string | number | (() => void) | number[] | { a: number; })[] // Function comment function() { diff --git a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt index 72ba1411320..3e9777aea7c 100644 --- a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt +++ b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(8,5): error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'. Types of property 'pop' are incompatible. - Type '() => number | string' is not assignable to type '() => number'. - Type 'number | string' is not assignable to type 'number'. + Type '() => string | number' is not assignable to type '() => number'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(14,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'. Property '0' is missing in type 'number[]'. @@ -19,8 +19,8 @@ tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionConte ~~~~ !!! error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'. -!!! error TS2322: Type 'number | string' is not assignable to type 'number'. +!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'. +!!! error TS2322: Type 'string | number' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. // In a contextually typed array literal expression containing one or more spread elements, diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types index 1bbb6c41e8a..aad515b62ee 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types @@ -23,8 +23,8 @@ var as = [a, b]; // { x: number; y?: number };[] >b : { x: number; z?: number; } var bs = [b, a]; // { x: number; z?: number };[] ->bs : ({ x: number; z?: number; } | { x: number; y?: number; })[] ->[b, a] : ({ x: number; z?: number; } | { x: number; y?: number; })[] +>bs : ({ x: number; y?: number; } | { x: number; z?: number; })[] +>[b, a] : ({ x: number; y?: number; } | { x: number; z?: number; })[] >b : { x: number; z?: number; } >a : { x: number; y?: number; } diff --git a/tests/baselines/reference/arrayLiterals2ES5.types b/tests/baselines/reference/arrayLiterals2ES5.types index a9cf31611c2..6eae997f465 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.types +++ b/tests/baselines/reference/arrayLiterals2ES5.types @@ -24,8 +24,8 @@ var a1 = ["hello", "world"] >"world" : string var a2 = [, , , ...a0, "hello"]; ->a2 : (number | string)[] ->[, , , ...a0, "hello"] : (number | string)[] +>a2 : (string | number)[] +>[, , , ...a0, "hello"] : (string | number)[] > : undefined > : undefined > : undefined @@ -151,8 +151,8 @@ interface myArray2 extends Array { } >String : String var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] ->d0 : (number | boolean | string)[] ->[1, true, ...temp,] : (number | boolean | string)[] +>d0 : (string | number | boolean)[] +>[1, true, ...temp,] : (string | number | boolean)[] >1 : number >true : boolean >...temp : string @@ -214,8 +214,8 @@ var d8: number[][] = [[...temp1]] >temp1 : number[] var d9 = [[...temp1], ...["hello"]]; ->d9 : (number[] | string)[] ->[[...temp1], ...["hello"]] : (number[] | string)[] +>d9 : (string | number[])[] +>[[...temp1], ...["hello"]] : (string | number[])[] >[...temp1] : number[] >...temp1 : number >temp1 : number[] diff --git a/tests/baselines/reference/arrayLiterals2ES6.types b/tests/baselines/reference/arrayLiterals2ES6.types index b6bf4f1de1b..f05b0ca9282 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.types +++ b/tests/baselines/reference/arrayLiterals2ES6.types @@ -24,8 +24,8 @@ var a1 = ["hello", "world"] >"world" : string var a2 = [, , , ...a0, "hello"]; ->a2 : (number | string)[] ->[, , , ...a0, "hello"] : (number | string)[] +>a2 : (string | number)[] +>[, , , ...a0, "hello"] : (string | number)[] > : undefined > : undefined > : undefined @@ -140,8 +140,8 @@ interface myArray2 extends Array { } >String : String var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[] ->d0 : (number | boolean | string)[] ->[1, true, ...temp, ] : (number | boolean | string)[] +>d0 : (string | number | boolean)[] +>[1, true, ...temp, ] : (string | number | boolean)[] >1 : number >true : boolean >...temp : string @@ -176,10 +176,10 @@ var d4: myArray2 = [...temp, ...temp1]; >temp1 : number[] var d5 = [...a2]; ->d5 : (number | string)[] ->[...a2] : (number | string)[] ->...a2 : number | string ->a2 : (number | string)[] +>d5 : (string | number)[] +>[...a2] : (string | number)[] +>...a2 : string | number +>a2 : (string | number)[] var d6 = [...a3]; >d6 : number[] @@ -201,8 +201,8 @@ var d8: number[][] = [[...temp1]] >temp1 : number[] var d9 = [[...temp1], ...["hello"]]; ->d9 : (number[] | string)[] ->[[...temp1], ...["hello"]] : (number[] | string)[] +>d9 : (string | number[])[] +>[[...temp1], ...["hello"]] : (string | number[])[] >[...temp1] : number[] >...temp1 : number >temp1 : number[] diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index f205e90eced..8e6c7eccf81 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -5,19 +5,19 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'. Types of property 'pop' are incompatible. - Type '() => number | string | boolean' is not assignable to type '() => number'. - Type 'number | string | boolean' is not assignable to type 'number'. + Type '() => string | number | boolean' is not assignable to type '() => number'. + Type 'string | number | boolean' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2322: Type '(number[] | string[])[]' is not assignable to type 'tup'. Property '0' is missing in type '(number[] | string[])[]'. tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'. Property '0' is missing in type 'number[]'. -tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. Types of property 'push' are incompatible. - Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. + Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'. Types of parameters 'items' and 'items' are incompatible. - Type 'Number' is not assignable to type 'number | string'. - Type 'Number' is not assignable to type 'string'. + Type 'Number' is not assignable to type 'string | number'. + Type 'Number' is not assignable to type 'number'. ==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ==== @@ -48,8 +48,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error ~~~~~~~~ !!! error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number'. -!!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number'. +!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => number'. +!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. // The resulting type an array literal expression is determined as follows: @@ -75,10 +75,10 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error !!! error TS2322: Property '0' is missing in type 'number[]'. var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[] ~~ -!!! error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'. +!!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'. !!! error TS2322: Types of property 'push' are incompatible. -!!! error TS2322: Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. +!!! error TS2322: Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'. !!! error TS2322: Types of parameters 'items' and 'items' are incompatible. -!!! error TS2322: Type 'Number' is not assignable to type 'number | string'. -!!! error TS2322: Type 'Number' is not assignable to type 'string'. +!!! error TS2322: Type 'Number' is not assignable to type 'string | number'. +!!! error TS2322: Type 'Number' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/asOperator1.types b/tests/baselines/reference/asOperator1.types index cc8a49ddc55..3f69871ea09 100644 --- a/tests/baselines/reference/asOperator1.types +++ b/tests/baselines/reference/asOperator1.types @@ -24,12 +24,12 @@ var z = Date as any as string; // Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string' var j = 32 as number|string; ->j : number | string ->32 as number|string : number | string +>j : string | number +>32 as number|string : string | number >32 : number j = ''; >j = '' : string ->j : number | string +>j : string | number >'' : string diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt index c7552c3fdb2..03dcee9baf3 100644 --- a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt +++ b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'. Types of property 'pop' are incompatible. - Type '() => number | string' is not assignable to type '() => number'. - Type 'number | string' is not assignable to type 'number'. + Type '() => string | number' is not assignable to type '() => number'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]'. Property '0' is missing in type '{}[]'. @@ -28,8 +28,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~~~~~~ !!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'. -!!! error TS2322: Type 'number | string' is not assignable to type 'number'. +!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'. +!!! error TS2322: Type 'string | number' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. emptyObjTuple = emptyObjArray; ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/awaitUnion_es6.types b/tests/baselines/reference/awaitUnion_es6.types index 97d4bd2fc57..eabcb56e59c 100644 --- a/tests/baselines/reference/awaitUnion_es6.types +++ b/tests/baselines/reference/awaitUnion_es6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/async/es6/awaitUnion_es6.ts === declare let a: number | string; ->a : number | string +>a : string | number declare let b: PromiseLike | PromiseLike; >b : PromiseLike | PromiseLike @@ -8,7 +8,7 @@ declare let b: PromiseLike | PromiseLike; >PromiseLike : PromiseLike declare let c: PromiseLike; ->c : PromiseLike +>c : PromiseLike >PromiseLike : PromiseLike declare let d: number | PromiseLike; @@ -16,34 +16,34 @@ declare let d: number | PromiseLike; >PromiseLike : PromiseLike declare let e: number | PromiseLike; ->e : number | PromiseLike +>e : number | PromiseLike >PromiseLike : PromiseLike async function f() { >f : () => Promise let await_a = await a; ->await_a : number | string ->await a : number | string ->a : number | string +>await_a : string | number +>await a : string | number +>a : string | number let await_b = await b; ->await_b : number | string ->await b : number | string +>await_b : string | number +>await b : string | number >b : PromiseLike | PromiseLike let await_c = await c; ->await_c : number | string ->await c : number | string ->c : PromiseLike +>await_c : string | number +>await c : string | number +>c : PromiseLike let await_d = await d; ->await_d : number | string ->await d : number | string +>await_d : string | number +>await d : string | number >d : number | PromiseLike let await_e = await e; ->await_e : number | string ->await e : number | string ->e : number | PromiseLike +>await_e : string | number +>await e : string | number +>e : number | PromiseLike } diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types index 1191004a32b..2a5ee6a2fe2 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types @@ -60,8 +60,8 @@ var r4 = true ? a : b; // typeof a >b : { x: number; z?: number; } var r5 = true ? b : a; // typeof b ->r5 : { x: number; z?: number; } | { x: number; y?: number; } ->true ? b : a : { x: number; z?: number; } | { x: number; y?: number; } +>r5 : { x: number; y?: number; } | { x: number; z?: number; } +>true ? b : a : { x: number; y?: number; } | { x: number; z?: number; } >true : boolean >b : { x: number; z?: number; } >a : { x: number; y?: number; } diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.types index ef9ecfb2a11..833bddd0e7c 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.types +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.types @@ -29,8 +29,8 @@ var derived2: Derived2; >Derived2 : Derived2 var r2 = true ? 1 : ''; ->r2 : number | string ->true ? 1 : '' : number | string +>r2 : string | number +>true ? 1 : '' : string | number >true : boolean >1 : number >'' : string diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types index 7d3330f4863..6aa84f37eba 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple.types @@ -98,8 +98,8 @@ var e3 = t3[2]; // any >2 : number var e4 = t4[3]; // number ->e4 : E1 | E2 | number ->t4[3] : E1 | E2 | number +>e4 : number | E1 | E2 +>t4[3] : number | E1 | E2 >t4 : [E1, E2, number] >3 : number diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.types b/tests/baselines/reference/bestCommonTypeOfTuple2.types index 573e3466376..864d3030d88 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.types @@ -66,8 +66,8 @@ var t5: [C1, F] >F : F var e11 = t1[4]; // base ->e11 : C | base ->t1[4] : C | base +>e11 : base | C +>t1[4] : base | C >t1 : [C, base] >4 : number @@ -90,8 +90,8 @@ var e41 = t4[2]; // base1 >2 : number var e51 = t5[2]; // {} ->e51 : C1 | F ->t5[2] : C1 | F +>e51 : F | C1 +>t5[2] : F | C1 >t5 : [C1, F] >2 : number diff --git a/tests/baselines/reference/callWithSpread.types b/tests/baselines/reference/callWithSpread.types index eae92c471e9..bc120dc4043 100644 --- a/tests/baselines/reference/callWithSpread.types +++ b/tests/baselines/reference/callWithSpread.types @@ -163,8 +163,8 @@ xa[1].foo(1, 2, ...a, "abc"); >xa : X[] >1 : number >foo : (x: number, y: number, ...z: string[]) => any ->...[1, 2, "abc"] : number | string ->[1, 2, "abc"] : (number | string)[] +>...[1, 2, "abc"] : string | number +>[1, 2, "abc"] : (string | number)[] >1 : number >2 : number >"abc" : string diff --git a/tests/baselines/reference/callWithSpreadES6.types b/tests/baselines/reference/callWithSpreadES6.types index b0c118855fe..99fe1330df9 100644 --- a/tests/baselines/reference/callWithSpreadES6.types +++ b/tests/baselines/reference/callWithSpreadES6.types @@ -164,8 +164,8 @@ xa[1].foo(1, 2, ...a, "abc"); >xa : X[] >1 : number >foo : (x: number, y: number, ...z: string[]) => any ->...[1, 2, "abc"] : number | string ->[1, 2, "abc"] : (number | string)[] +>...[1, 2, "abc"] : string | number +>[1, 2, "abc"] : (string | number)[] >1 : number >2 : number >"abc" : string diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.types b/tests/baselines/reference/computedPropertyNames1_ES5.types index bcff3b34177..a77895e06d1 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.types +++ b/tests/baselines/reference/computedPropertyNames1_ES5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts === var v = { ->v : { [x: number]: number | string; } ->{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; } +>v : { [x: number]: string | number; } +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: string | number; } get [0 + 1]() { return 0 }, >0 + 1 : number diff --git a/tests/baselines/reference/computedPropertyNames1_ES6.types b/tests/baselines/reference/computedPropertyNames1_ES6.types index df2237a463f..503988b0314 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES6.types +++ b/tests/baselines/reference/computedPropertyNames1_ES6.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts === var v = { ->v : { [x: number]: number | string; } ->{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; } +>v : { [x: number]: string | number; } +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: string | number; } get [0 + 1]() { return 0 }, >0 + 1 : number diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.types b/tests/baselines/reference/computedPropertyNames4_ES5.types index 3c5f884640f..a71b3984ec8 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.types +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } +>v : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.types b/tests/baselines/reference/computedPropertyNames4_ES6.types index 335c2415bd0..a4bcc59711c 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES6.types +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; } +>v : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index b49724ccded..e5b7440f49e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -17,9 +17,9 @@ declare function foo(obj: I): T >T : T foo({ ->foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types index e88959d7cdc..71498d7f3d4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -17,9 +17,9 @@ declare function foo(obj: I): T >T : T foo({ ->foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types index 64367864881..c2099456303 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types @@ -33,9 +33,9 @@ declare function g(obj: J): T; >T : T foo({ ->foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] +>foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] >foo : (obj: I) => T ->{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; } +>{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; } 0: () => { }, >() => { } : () => void diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types index 07aeda807b0..6ae7d7eeada 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types @@ -33,9 +33,9 @@ declare function g(obj: J): T; >T : T foo({ ->foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] +>foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] >foo : (obj: I) => T ->{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; } +>{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; } 0: () => { }, >() => { } : () => void diff --git a/tests/baselines/reference/conditionalExpression1.errors.txt b/tests/baselines/reference/conditionalExpression1.errors.txt index 49ed2095353..0e291986785 100644 --- a/tests/baselines/reference/conditionalExpression1.errors.txt +++ b/tests/baselines/reference/conditionalExpression1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type 'number | string' is not assignable to type 'boolean'. - Type 'number' is not assignable to type 'boolean'. +tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. ==== tests/cases/compiler/conditionalExpression1.ts (1 errors) ==== var x: boolean = (true ? 1 : ""); // should be an error ~ -!!! error TS2322: Type 'number | string' is not assignable to type 'boolean'. -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types index 026c8f42272..3f5f6454eda 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types @@ -218,7 +218,7 @@ var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2; //Expr1 and Expr2 are literals var result11: any = true ? 1 : 'string'; >result11 : any ->true ? 1 : 'string' : number | string +>true ? 1 : 'string' : string | number >true : boolean >1 : number >'string' : string diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 20f4ac1a335..4011a51f557 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -38,9 +38,9 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,30): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,31): error TS2304: Cannot find name 'Property'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(167,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(181,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(182,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(184,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(192,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(182,13): error TS2322: Type 'boolean' is not assignable to type 'number | true'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(184,13): error TS2322: Type 'boolean' is not assignable to type 'number | true'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(192,13): error TS2322: Type 'boolean' is not assignable to type 'number | true'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(206,28): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(214,16): error TS2304: Cannot find name 'bool'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(219,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. @@ -353,11 +353,11 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS !!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. b = !b;/*!*/ ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number | true'. i = ~i;/*~i*/ b = i < (i - 1) && (i + 1) > i;/*< && >*/ ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number | true'. var f = true ? 1 : 0;/*? :*/ // YES : i++;/*++*/ i--;/*--*/ @@ -367,7 +367,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS var j = i; b = i == j && i != j && i <= j && i >= j;/*= == && != <= >=*/ ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'. +!!! error TS2322: Type 'boolean' is not assignable to type 'number | true'. i += 5.0;/*+=*/ i -= i;/*-=*/ i *= i;/**=*/ diff --git a/tests/baselines/reference/contextualSignatureInstantiation.types b/tests/baselines/reference/contextualSignatureInstantiation.types index dd88a00ae3a..49d6871804c 100644 --- a/tests/baselines/reference/contextualSignatureInstantiation.types +++ b/tests/baselines/reference/contextualSignatureInstantiation.types @@ -87,24 +87,24 @@ var a = baz(1, 1, g); // Should be number >g : (x: T, y: T) => T var b: number | string; ->b : number | string +>b : string | number var b = foo(g); // Should be number | string ->b : number | string ->foo(g) : number | string +>b : string | number +>foo(g) : string | number >foo : (cb: (x: number, y: string) => T) => T >g : (x: T, y: T) => T var b = bar(1, "one", g); // Should be number | string ->b : number | string ->bar(1, "one", g) : number | string +>b : string | number +>bar(1, "one", g) : string | number >bar : (x: T, y: U, cb: (x: T, y: U) => V) => V >1 : number >"one" : string >g : (x: T, y: T) => T var b = bar("one", 1, g); // Should be number | string ->b : number | string +>b : string | number >bar("one", 1, g) : string | number >bar : (x: T, y: U, cb: (x: T, y: U) => V) => V >"one" : string @@ -112,11 +112,11 @@ var b = bar("one", 1, g); // Should be number | string >g : (x: T, y: T) => T var b = baz(b, b, g); // Should be number | string ->b : number | string ->baz(b, b, g) : number | string +>b : string | number +>baz(b, b, g) : string | number >baz : (x: T, y: T, cb: (x: T, y: T) => U) => U ->b : number | string ->b : number | string +>b : string | number +>b : string | number >g : (x: T, y: T) => T var d: number[] | string[]; @@ -138,7 +138,7 @@ var d = bar(1, "one", h); // Should be number[] | string[] var d = bar("one", 1, h); // Should be number[] | string[] >d : number[] | string[] ->bar("one", 1, h) : string[] | number[] +>bar("one", 1, h) : number[] | string[] >bar : (x: T, y: U, cb: (x: T, y: U) => V) => V >"one" : string >1 : number diff --git a/tests/baselines/reference/contextualTypeWithTuple.errors.txt b/tests/baselines/reference/contextualTypeWithTuple.errors.txt index d0091aa1e22..e0580ca2379 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.errors.txt +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. Types of property 'pop' are incompatible. - Type '() => number | string | boolean' is not assignable to type '() => number | string'. - Type 'number | string | boolean' is not assignable to type 'number | string'. - Type 'true' is not assignable to type 'number | string'. + Type '() => string | number | boolean' is not assignable to type '() => string | number'. + Type 'string | number | boolean' is not assignable to type 'string | number'. + Type 'true' is not assignable to type 'string | number'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'. Types of property '0' are incompatible. @@ -30,9 +30,9 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23 ~~~~~~~~~~~~ !!! error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number | string'. -!!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number | string'. -!!! error TS2322: Type 'true' is not assignable to type 'number | string'. +!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number'. +!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'string | number'. +!!! error TS2322: Type 'true' is not assignable to type 'string | number'. var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; diff --git a/tests/baselines/reference/contextualTyping21.errors.txt b/tests/baselines/reference/contextualTyping21.errors.txt index db6ecd32b97..0bac30d5b44 100644 --- a/tests/baselines/reference/contextualTyping21.errors.txt +++ b/tests/baselines/reference/contextualTyping21.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'. - Type '{ id: number; } | number' is not assignable to type '{ id: number; }'. +tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'. + Type 'number | { id: number; }' is not assignable to type '{ id: number; }'. Type 'number' is not assignable to type '{ id: number; }'. ==== tests/cases/compiler/contextualTyping21.ts (1 errors) ==== var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, 1]; ~~~ -!!! error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'. -!!! error TS2322: Type '{ id: number; } | number' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type 'number | { id: number; }' is not assignable to type '{ id: number; }'. !!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping30.errors.txt b/tests/baselines/reference/contextualTyping30.errors.txt index bce19c50896..eda30769ac8 100644 --- a/tests/baselines/reference/contextualTyping30.errors.txt +++ b/tests/baselines/reference/contextualTyping30.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/contextualTyping30.ts(1,37): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. - Type 'number | string' is not assignable to type 'number'. +tests/cases/compiler/contextualTyping30.ts(1,37): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/contextualTyping30.ts (1 errors) ==== function foo(param:number[]){}; foo([1, "a"]); ~~~~~~~~ -!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'number | string' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt index 698a8e789f0..be73de51f13 100644 --- a/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt +++ b/tests/baselines/reference/contextualTypingOfArrayLiterals1.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type '(Date | number)[]' is not assignable to type 'I'. +tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type '(number | Date)[]' is not assignable to type 'I'. Index signatures are incompatible. - Type 'Date | number' is not assignable to type 'Date'. + Type 'number | Date' is not assignable to type 'Date'. Type 'number' is not assignable to type 'Date'. @@ -11,9 +11,9 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ var x3: I = [new Date(), 1]; ~~ -!!! error TS2322: Type '(Date | number)[]' is not assignable to type 'I'. +!!! error TS2322: Type '(number | Date)[]' is not assignable to type 'I'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'Date | number' is not assignable to type 'Date'. +!!! error TS2322: Type 'number | Date' is not assignable to type 'Date'. !!! error TS2322: Type 'number' is not assignable to type 'Date'. var r2 = x3[1]; r2.getDate(); diff --git a/tests/baselines/reference/contextuallyTypedIife.types b/tests/baselines/reference/contextuallyTypedIife.types index 0f2092ef7c3..8777e3cef3f 100644 --- a/tests/baselines/reference/contextuallyTypedIife.types +++ b/tests/baselines/reference/contextuallyTypedIife.types @@ -119,18 +119,18 @@ ((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); >((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean ->((...mixed) => mixed.every(n => !!n)) : (...mixed: (number | string)[]) => boolean ->(...mixed) => mixed.every(n => !!n) : (...mixed: (number | string)[]) => boolean ->mixed : (number | string)[] +>((...mixed) => mixed.every(n => !!n)) : (...mixed: (string | number)[]) => boolean +>(...mixed) => mixed.every(n => !!n) : (...mixed: (string | number)[]) => boolean +>mixed : (string | number)[] >mixed.every(n => !!n) : boolean ->mixed.every : (callbackfn: (value: number | string, index: number, array: (number | string)[]) => boolean, thisArg?: any) => boolean ->mixed : (number | string)[] ->every : (callbackfn: (value: number | string, index: number, array: (number | string)[]) => boolean, thisArg?: any) => boolean ->n => !!n : (n: number | string) => boolean ->n : number | string +>mixed.every : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => boolean, thisArg?: any) => boolean +>mixed : (string | number)[] +>every : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => boolean, thisArg?: any) => boolean +>n => !!n : (n: string | number) => boolean +>n : string | number >!!n : boolean >!n : boolean ->n : number | string +>n : string | number >5 : number >'oops' : string >'oh no' : string diff --git a/tests/baselines/reference/controlFlowAssignmentExpression.types b/tests/baselines/reference/controlFlowAssignmentExpression.types index 24355fd8c4a..107fb4cb332 100644 --- a/tests/baselines/reference/controlFlowAssignmentExpression.types +++ b/tests/baselines/reference/controlFlowAssignmentExpression.types @@ -1,18 +1,18 @@ === tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts === let x: string | boolean | number; ->x : string | boolean | number +>x : string | number | boolean let obj: any; >obj : any x = ""; >x = "" : string ->x : string | boolean | number +>x : string | number | boolean >"" : string x = x.length; >x = x.length : number ->x : string | boolean | number +>x : string | number | boolean >x.length : number >x : string >length : number @@ -22,7 +22,7 @@ x; // number x = true; >x = true : boolean ->x : string | boolean | number +>x : string | number | boolean >true : boolean (x = "", obj).foo = (x = x.length); @@ -31,13 +31,13 @@ x = true; >(x = "", obj) : any >x = "", obj : any >x = "" : string ->x : string | boolean | number +>x : string | number | boolean >"" : string >obj : any >foo : any >(x = x.length) : number >x = x.length : number ->x : string | boolean | number +>x : string | number | boolean >x.length : number >x : string >length : number diff --git a/tests/baselines/reference/controlFlowBinaryOrExpression.symbols b/tests/baselines/reference/controlFlowBinaryOrExpression.symbols index 8af9a35c182..e76cfbf4cab 100644 --- a/tests/baselines/reference/controlFlowBinaryOrExpression.symbols +++ b/tests/baselines/reference/controlFlowBinaryOrExpression.symbols @@ -64,9 +64,9 @@ if (isNodeList(sourceObj)) { >sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) sourceObj.length; ->sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27)) +>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33)) >sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) ->length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27)) +>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33)) } if (isHTMLCollection(sourceObj)) { @@ -74,9 +74,9 @@ if (isHTMLCollection(sourceObj)) { >sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) sourceObj.length; ->sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27)) +>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33)) >sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) ->length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27)) +>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33)) } if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { @@ -86,8 +86,8 @@ if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { >sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) sourceObj.length; ->sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27)) +>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33)) >sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3)) ->length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27)) +>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33)) } diff --git a/tests/baselines/reference/controlFlowBinaryOrExpression.types b/tests/baselines/reference/controlFlowBinaryOrExpression.types index bf2a55e24e7..11f28b3df19 100644 --- a/tests/baselines/reference/controlFlowBinaryOrExpression.types +++ b/tests/baselines/reference/controlFlowBinaryOrExpression.types @@ -25,7 +25,7 @@ x = ""; >"" : string cond || (x = 0); ->cond || (x = 0) : true | number +>cond || (x = 0) : number | true >cond : boolean >(x = 0) : number >x = 0 : number @@ -62,36 +62,36 @@ declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection; >HTMLCollection : HTMLCollection type EventTargetLike = {a: string} | HTMLCollection | NodeList; ->EventTargetLike : { a: string; } | HTMLCollection | NodeList +>EventTargetLike : NodeList | HTMLCollection | { a: string; } >a : string >HTMLCollection : HTMLCollection >NodeList : NodeList var sourceObj: EventTargetLike = undefined; ->sourceObj : { a: string; } | HTMLCollection | NodeList ->EventTargetLike : { a: string; } | HTMLCollection | NodeList +>sourceObj : NodeList | HTMLCollection | { a: string; } +>EventTargetLike : NodeList | HTMLCollection | { a: string; } >undefined : any >undefined : undefined if (isNodeList(sourceObj)) { >isNodeList(sourceObj) : boolean >isNodeList : (sourceObj: any) => sourceObj is NodeList ->sourceObj : { a: string; } | HTMLCollection | NodeList +>sourceObj : NodeList | HTMLCollection | { a: string; } sourceObj.length; >sourceObj.length : number ->sourceObj : HTMLCollection | NodeList +>sourceObj : NodeList | HTMLCollection >length : number } if (isHTMLCollection(sourceObj)) { >isHTMLCollection(sourceObj) : boolean >isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection ->sourceObj : HTMLCollection | NodeList | { a: string; } +>sourceObj : NodeList | HTMLCollection | { a: string; } sourceObj.length; >sourceObj.length : number ->sourceObj : HTMLCollection | NodeList +>sourceObj : NodeList | HTMLCollection >length : number } @@ -99,14 +99,14 @@ if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { >isNodeList(sourceObj) || isHTMLCollection(sourceObj) : boolean >isNodeList(sourceObj) : boolean >isNodeList : (sourceObj: any) => sourceObj is NodeList ->sourceObj : HTMLCollection | NodeList | { a: string; } +>sourceObj : NodeList | HTMLCollection | { a: string; } >isHTMLCollection(sourceObj) : boolean >isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection >sourceObj : { a: string; } sourceObj.length; >sourceObj.length : number ->sourceObj : HTMLCollection | NodeList | ({ a: string; } & HTMLCollection) +>sourceObj : NodeList | HTMLCollection | ({ a: string; } & HTMLCollection) >length : number } diff --git a/tests/baselines/reference/controlFlowCommaOperator.types b/tests/baselines/reference/controlFlowCommaOperator.types index 328bffc42ab..211fae3655a 100644 --- a/tests/baselines/reference/controlFlowCommaOperator.types +++ b/tests/baselines/reference/controlFlowCommaOperator.types @@ -66,6 +66,6 @@ function f(x: string | number | boolean) { >y : string z; // number | boolean ->z : boolean | number +>z : number | boolean } diff --git a/tests/baselines/reference/controlFlowDeleteOperator.types b/tests/baselines/reference/controlFlowDeleteOperator.types index 365174db058..b0040f12bc2 100644 --- a/tests/baselines/reference/controlFlowDeleteOperator.types +++ b/tests/baselines/reference/controlFlowDeleteOperator.types @@ -4,76 +4,76 @@ function f() { >f : () => void let x: { a?: number | string, b: number | string } = { b: 1 }; ->x : { a?: number | string | undefined; b: number | string; } ->a : number | string | undefined ->b : number | string +>x : { a?: string | number | undefined; b: string | number; } +>a : string | number | undefined +>b : string | number >{ b: 1 } : { b: number; } >b : number >1 : number x.a; ->x.a : number | string | undefined ->x : { a?: number | string | undefined; b: number | string; } ->a : number | string | undefined +>x.a : string | number | undefined +>x : { a?: string | number | undefined; b: string | number; } +>a : string | number | undefined x.b; ->x.b : number | string ->x : { a?: number | string | undefined; b: number | string; } ->b : number | string +>x.b : string | number +>x : { a?: string | number | undefined; b: string | number; } +>b : string | number x.a = 1; >x.a = 1 : number ->x.a : number | string | undefined ->x : { a?: number | string | undefined; b: number | string; } ->a : number | string | undefined +>x.a : string | number | undefined +>x : { a?: string | number | undefined; b: string | number; } +>a : string | number | undefined >1 : number x.b = 1; >x.b = 1 : number ->x.b : number | string ->x : { a?: number | string | undefined; b: number | string; } ->b : number | string +>x.b : string | number +>x : { a?: string | number | undefined; b: string | number; } +>b : string | number >1 : number x.a; >x.a : number ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } >a : number x.b; >x.b : number ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } >b : number delete x.a; >delete x.a : boolean >x.a : number ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } >a : number delete x.b; >delete x.b : boolean >x.b : number ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } >b : number x.a; >x.a : undefined ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } >a : undefined x.b; ->x.b : number | string ->x : { a?: number | string | undefined; b: number | string; } ->b : number | string +>x.b : string | number +>x : { a?: string | number | undefined; b: string | number; } +>b : string | number x; ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } delete x; // No effect >delete x : boolean ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } x; ->x : { a?: number | string | undefined; b: number | string; } +>x : { a?: string | number | undefined; b: string | number; } } diff --git a/tests/baselines/reference/controlFlowDoWhileStatement.types b/tests/baselines/reference/controlFlowDoWhileStatement.types index ffd9f03096f..55329cbcea1 100644 --- a/tests/baselines/reference/controlFlowDoWhileStatement.types +++ b/tests/baselines/reference/controlFlowDoWhileStatement.types @@ -131,13 +131,13 @@ function f() { >f : () => void let x: string | number | boolean | RegExp | Function; ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >RegExp : RegExp >Function : Function x = ""; >x = "" : string ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >"" : string do { @@ -146,7 +146,7 @@ function f() { x = 42; >x = 42 : number ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >42 : number break; @@ -156,14 +156,14 @@ function f() { x = true; >x = true : boolean ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >true : boolean continue; } x = /a/; >x = /a/ : RegExp ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >/a/ : RegExp } while (cond) @@ -176,13 +176,13 @@ function g() { >g : () => void let x: string | number | boolean | RegExp | Function; ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >RegExp : RegExp >Function : Function x = ""; >x = "" : string ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >"" : string do { @@ -191,7 +191,7 @@ function g() { x = 42; >x = 42 : number ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >42 : number break; @@ -201,14 +201,14 @@ function g() { x = true; >x = true : boolean ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >true : boolean continue; } x = /a/; >x = /a/ : RegExp ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >/a/ : RegExp } while (true) diff --git a/tests/baselines/reference/controlFlowForInStatement.types b/tests/baselines/reference/controlFlowForInStatement.types index e46db37bb16..cab3a701602 100644 --- a/tests/baselines/reference/controlFlowForInStatement.types +++ b/tests/baselines/reference/controlFlowForInStatement.types @@ -1,6 +1,6 @@ === tests/cases/conformance/controlFlow/controlFlowForInStatement.ts === let x: string | number | boolean | RegExp | Function; ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >RegExp : RegExp >Function : Function @@ -12,7 +12,7 @@ let cond: boolean; x = /a/; >x = /a/ : RegExp ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >/a/ : RegExp for (let y in obj) { @@ -21,7 +21,7 @@ for (let y in obj) { x = y; >x = y : string ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >y : string if (cond) { @@ -29,7 +29,7 @@ for (let y in obj) { x = 42; >x = 42 : number ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >42 : number continue; @@ -39,12 +39,12 @@ for (let y in obj) { x = true; >x = true : boolean ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >true : boolean break; } } x; // RegExp | string | number | boolean ->x : RegExp | number | string | boolean +>x : string | number | boolean | RegExp diff --git a/tests/baselines/reference/controlFlowForOfStatement.types b/tests/baselines/reference/controlFlowForOfStatement.types index 437576e51b6..41e312347e7 100644 --- a/tests/baselines/reference/controlFlowForOfStatement.types +++ b/tests/baselines/reference/controlFlowForOfStatement.types @@ -27,6 +27,6 @@ function a() { >toExponential : (fractionDigits?: number) => string } x; // string | boolean ->x : boolean | string +>x : string | boolean } diff --git a/tests/baselines/reference/controlFlowPropertyDeclarations.types b/tests/baselines/reference/controlFlowPropertyDeclarations.types index 38f05122d69..030f22a1ffb 100644 --- a/tests/baselines/reference/controlFlowPropertyDeclarations.types +++ b/tests/baselines/reference/controlFlowPropertyDeclarations.types @@ -316,9 +316,9 @@ export class HTMLtoJSX { >'{' + JSON.stringify(whitespace) : string >'{' : string >JSON.stringify(whitespace) : string ->JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (number | string)[], space?: string | number): string; } +>JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } >JSON : JSON ->stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (number | string)[], space?: string | number): string; } +>stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } >whitespace : string >'}' : string diff --git a/tests/baselines/reference/controlFlowWhileStatement.types b/tests/baselines/reference/controlFlowWhileStatement.types index 5ab48e02e2b..8caae2238d2 100644 --- a/tests/baselines/reference/controlFlowWhileStatement.types +++ b/tests/baselines/reference/controlFlowWhileStatement.types @@ -135,13 +135,13 @@ function f() { >f : () => void let x: string | number | boolean | RegExp | Function; ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >RegExp : RegExp >Function : Function x = ""; >x = "" : string ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >"" : string while (cond) { @@ -152,7 +152,7 @@ function f() { x = 42; >x = 42 : number ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >42 : number break; @@ -162,30 +162,30 @@ function f() { x = true; >x = true : boolean ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >true : boolean continue; } x = /a/; >x = /a/ : RegExp ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >/a/ : RegExp } x; // string | number | boolean | RegExp ->x : string | boolean | RegExp | number +>x : string | number | boolean | RegExp } function g() { >g : () => void let x: string | number | boolean | RegExp | Function; ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >RegExp : RegExp >Function : Function x = ""; >x = "" : string ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >"" : string while (true) { @@ -196,7 +196,7 @@ function g() { x = 42; >x = 42 : number ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >42 : number break; @@ -206,14 +206,14 @@ function g() { x = true; >x = true : boolean ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >true : boolean continue; } x = /a/; >x = /a/ : RegExp ->x : string | number | boolean | RegExp | Function +>x : string | number | boolean | Function | RegExp >/a/ : RegExp } x; // number diff --git a/tests/baselines/reference/declFileTypeAnnotationParenType.js b/tests/baselines/reference/declFileTypeAnnotationParenType.js index 4afe07cc9d8..4707007cd1b 100644 --- a/tests/baselines/reference/declFileTypeAnnotationParenType.js +++ b/tests/baselines/reference/declFileTypeAnnotationParenType.js @@ -29,4 +29,4 @@ declare class c { declare var x: (() => c)[]; declare var y: (() => c)[]; declare var k: (() => c) | string; -declare var l: (() => c) | string; +declare var l: string | (() => c); diff --git a/tests/baselines/reference/declFileTypeAnnotationParenType.types b/tests/baselines/reference/declFileTypeAnnotationParenType.types index 6776a0f492f..31b6ad03751 100644 --- a/tests/baselines/reference/declFileTypeAnnotationParenType.types +++ b/tests/baselines/reference/declFileTypeAnnotationParenType.types @@ -23,9 +23,9 @@ var y = [() => new c()]; >c : typeof c var k: (() => c) | string = (() => new c()) || ""; ->k : (() => c) | string +>k : string | (() => c) >c : c ->(() => new c()) || "" : (() => c) | string +>(() => new c()) || "" : string | (() => c) >(() => new c()) : () => c >() => new c() : () => c >new c() : c @@ -33,8 +33,8 @@ var k: (() => c) | string = (() => new c()) || ""; >"" : string var l = (() => new c()) || ""; ->l : (() => c) | string ->(() => new c()) || "" : (() => c) | string +>l : string | (() => c) +>(() => new c()) || "" : string | (() => c) >(() => new c()) : () => c >() => new c() : () => c >new c() : c diff --git a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types index e93f86dbde7..beef88c0ca2 100644 --- a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types +++ b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types @@ -47,7 +47,7 @@ module M { >M : typeof M export type W = Window | string; ->W : Window | string +>W : string | Window >Window : Window export module N { @@ -57,7 +57,7 @@ module M { >Window : Window export var p: W; ->p : Window | string ->W : Window | string +>p : string | Window +>W : string | Window } } diff --git a/tests/baselines/reference/declarationEmitDestructuring3.js b/tests/baselines/reference/declarationEmitDestructuring3.js index 81cb1d96fd8..b21c63203c8 100644 --- a/tests/baselines/reference/declarationEmitDestructuring3.js +++ b/tests/baselines/reference/declarationEmitDestructuring3.js @@ -15,4 +15,4 @@ function foo(_a) { //// [declarationEmitDestructuring3.d.ts] declare function bar([x, z, ...w]: any[]): void; -declare function foo([x, ...y]?: (number | string | boolean)[]): void; +declare function foo([x, ...y]?: (string | number | boolean)[]): void; diff --git a/tests/baselines/reference/declarationEmitDestructuring3.types b/tests/baselines/reference/declarationEmitDestructuring3.types index 737bb39e078..da9fc6d6606 100644 --- a/tests/baselines/reference/declarationEmitDestructuring3.types +++ b/tests/baselines/reference/declarationEmitDestructuring3.types @@ -6,10 +6,10 @@ function bar([x, z, ...w]) { } >w : any[] function foo([x, ...y] = [1, "string", true]) { } ->foo : ([x, ...y]?: (number | string | boolean)[]) => void ->x : number | string | boolean ->y : (number | string | boolean)[] ->[1, "string", true] : (number | string | boolean)[] +>foo : ([x, ...y]?: (string | number | boolean)[]) => void +>x : string | number | boolean +>y : (string | number | boolean)[] +>[1, "string", true] : (string | number | boolean)[] >1 : number >"string" : string >true : boolean diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js index 28330d94f77..9a9be8c69da 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js @@ -23,6 +23,6 @@ var x3 = a[0], y3 = a[1], z3 = a[2]; // emit x3, y3, z3 declare var x: number; declare var x1: number, y1: string; declare var z1: number; -declare var a: (number | string)[]; -declare var x2: number | string; -declare var x3: number | string, y3: number | string, z3: number | string; +declare var a: (string | number)[]; +declare var x2: string | number; +declare var x3: string | number, y3: string | number, z3: string | number; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types index 9629324b9f9..0feeaf2db1a 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types @@ -1,7 +1,7 @@ === tests/cases/compiler/declarationEmitDestructuringArrayPattern1.ts === var [] = [1, "hello"]; // Dont emit anything ->[1, "hello"] : (number | string)[] +>[1, "hello"] : (string | number)[] >1 : number >"hello" : string @@ -28,18 +28,18 @@ var [, , z1] = [0, 1, 2]; // emit z1: number >2 : number var a = [1, "hello"]; ->a : (number | string)[] ->[1, "hello"] : (number | string)[] +>a : (string | number)[] +>[1, "hello"] : (string | number)[] >1 : number >"hello" : string var [x2] = a; // emit x2: number | string ->x2 : number | string ->a : (number | string)[] +>x2 : string | number +>a : (string | number)[] var [x3, y3, z3] = a; // emit x3, y3, z3 ->x3 : number | string ->y3 : number | string ->z3 : number | string ->a : (number | string)[] +>x3 : string | number +>y3 : string | number +>z3 : string | number +>a : (string | number)[] diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js index 662b4625ec8..818b3a6f7a9 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js @@ -25,7 +25,7 @@ declare var x11: number, y11: string; declare var a11: any, b11: any, c11: any; declare var a2: number, b2: string, x12: number, c2: boolean; declare var x13: number, y13: string; -declare var a3: (number | string)[], b3: { +declare var a3: (string | number)[], b3: { x: number; y: string; }; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js index d83c1b721d8..1bd07e7b974 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js @@ -25,7 +25,7 @@ declare var a5: number[]; declare var x14: number, a6: number[]; declare var x15: number, y15: number, a7: number[]; declare var x16: number, y16: number, z16: number, a8: number[]; -declare var a9: (number | string | boolean)[]; -declare var x17: number | string | boolean, a10: (number | string | boolean)[]; -declare var x18: number | string | boolean, y18: number | string | boolean, a12: (number | string | boolean)[]; -declare var x19: number | string | boolean, y19: number | string | boolean, z19: number | string | boolean, a13: (number | string | boolean)[]; +declare var a9: (string | number | boolean)[]; +declare var x17: string | number | boolean, a10: (string | number | boolean)[]; +declare var x18: string | number | boolean, y18: string | number | boolean, a12: (string | number | boolean)[]; +declare var x19: string | number | boolean, y19: string | number | boolean, z19: string | number | boolean, a13: (string | number | boolean)[]; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types index 1e8701eedb5..2cc56abcb05 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types @@ -34,35 +34,35 @@ var [x16, y16, z16, ...a8] = [1, 2, 3]; >3 : number var [...a9] = [1, "hello", true]; ->a9 : (number | string | boolean)[] ->[1, "hello", true] : (number | string | boolean)[] +>a9 : (string | number | boolean)[] +>[1, "hello", true] : (string | number | boolean)[] >1 : number >"hello" : string >true : boolean var [x17, ...a10] = [1, "hello", true]; ->x17 : number | string | boolean ->a10 : (number | string | boolean)[] ->[1, "hello", true] : (number | string | boolean)[] +>x17 : string | number | boolean +>a10 : (string | number | boolean)[] +>[1, "hello", true] : (string | number | boolean)[] >1 : number >"hello" : string >true : boolean var [x18, y18, ...a12] = [1, "hello", true]; ->x18 : number | string | boolean ->y18 : number | string | boolean ->a12 : (number | string | boolean)[] ->[1, "hello", true] : (number | string | boolean)[] +>x18 : string | number | boolean +>y18 : string | number | boolean +>a12 : (string | number | boolean)[] +>[1, "hello", true] : (string | number | boolean)[] >1 : number >"hello" : string >true : boolean var [x19, y19, z19, ...a13] = [1, "hello", true]; ->x19 : number | string | boolean ->y19 : number | string | boolean ->z19 : number | string | boolean ->a13 : (number | string | boolean)[] ->[1, "hello", true] : (number | string | boolean)[] +>x19 : string | number | boolean +>y19 : string | number | boolean +>z19 : string | number | boolean +>a13 : (string | number | boolean)[] +>[1, "hello", true] : (string | number | boolean)[] >1 : number >"hello" : string >true : boolean diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.types b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.types index 16dc655cc2f..8e42146b824 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.types +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.types @@ -1,21 +1,21 @@ === tests/cases/conformance/es6/moduleExportsAmd/a.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class Foo {} >Foo : Foo === tests/cases/conformance/es6/moduleExportsAmd/b.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class {} diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.types b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.types index 01aaf5c0dbe..ec4bd9f5476 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.types +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.types @@ -1,21 +1,21 @@ === tests/cases/conformance/es6/moduleExportsCommonjs/a.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class Foo {} >Foo : Foo === tests/cases/conformance/es6/moduleExportsCommonjs/b.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class {} diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.types b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.types index ae36b442665..0577559b7d9 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.types +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.types @@ -1,20 +1,20 @@ === tests/cases/conformance/es6/moduleExportsSystem/a.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class Foo {} >Foo : Foo === tests/cases/conformance/es6/moduleExportsSystem/b.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class {} diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.types b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.types index 68212835a6f..399c0a79ee2 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.types +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.types @@ -1,21 +1,21 @@ === tests/cases/conformance/es6/moduleExportsUmd/a.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class Foo {} >Foo : Foo === tests/cases/conformance/es6/moduleExportsUmd/b.ts === var decorator: ClassDecorator; ->decorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction @decorator ->decorator : (target: TFunction) => TFunction | void +>decorator : (target: TFunction) => void | TFunction export default class {} diff --git a/tests/baselines/reference/decoratorMetadataPromise.types b/tests/baselines/reference/decoratorMetadataPromise.types index 900e751e841..953458ca5fe 100644 --- a/tests/baselines/reference/decoratorMetadataPromise.types +++ b/tests/baselines/reference/decoratorMetadataPromise.types @@ -1,20 +1,20 @@ === tests/cases/compiler/decoratorMetadataPromise.ts === declare const decorator: MethodDecorator; ->decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void ->MethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void +>decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor +>MethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor class A { >A : A @decorator ->decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void +>decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor async foo() {} >foo : () => Promise @decorator ->decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void +>decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor async bar(): Promise { return 0; } >bar : () => Promise @@ -22,7 +22,7 @@ class A { >0 : number @decorator ->decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void +>decorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor baz(n: Promise): Promise { return n; } >baz : (n: Promise) => Promise diff --git a/tests/baselines/reference/destructureOptionalParameter.types b/tests/baselines/reference/destructureOptionalParameter.types index 2e569dee0a0..ea0e8c4b754 100644 --- a/tests/baselines/reference/destructureOptionalParameter.types +++ b/tests/baselines/reference/destructureOptionalParameter.types @@ -40,7 +40,7 @@ interface QueryMetadataFactory { >QueryMetadataFactory : QueryMetadataFactory (selector: Type | string, {descendants, read}?: { ->selector : Type | string +>selector : string | Type >Type : Type >descendants : boolean | undefined >read : any @@ -55,7 +55,7 @@ interface QueryMetadataFactory { >ParameterDecorator : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void new (selector: Type | string, {descendants, read}?: { ->selector : Type | string +>selector : string | Type >Type : Type >descendants : boolean | undefined >read : any diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index d68220c8308..878bb38abf0 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(7,29): error TS1005: ',' expected. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(8,4): error TS2345: Argument of type '[number, number, string[][], string]' is not assignable to parameter of type '[number, number, string[][]]'. Types of property 'pop' are incompatible. - Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'. - Type 'number | string[][] | string' is not assignable to type 'number | string[][]'. + Type '() => string | number | string[][]' is not assignable to type '() => number | string[][]'. + Type 'string | number | string[][]' is not assignable to type 'number | string[][]'. Type 'string' is not assignable to type 'number | string[][]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,8): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,16): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -25,9 +25,9 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,4): error TS2345: Argument of type '{ z: boolean; }' is not assignable to parameter of type '{ z?: number; }'. Types of property 'z' are incompatible. Type 'boolean' is not assignable to type 'number'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,4): error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,4): error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: string | number; }'. Types of property 'b' are incompatible. - Type 'boolean' is not assignable to type 'number | string'. + Type 'boolean' is not assignable to type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,4): error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. Types of property '2' are incompatible. Type 'boolean' is not assignable to type '[[any]]'. @@ -70,8 +70,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, number, string[][], string]' is not assignable to parameter of type '[number, number, string[][]]'. !!! error TS2345: Types of property 'pop' are incompatible. -!!! error TS2345: Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'. -!!! error TS2345: Type 'number | string[][] | string' is not assignable to type 'number | string[][]'. +!!! error TS2345: Type '() => string | number | string[][]' is not assignable to type '() => number | string[][]'. +!!! error TS2345: Type 'string | number | string[][]' is not assignable to type 'number | string[][]'. !!! error TS2345: Type 'string' is not assignable to type 'number | string[][]'. @@ -131,9 +131,9 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2345: Type 'boolean' is not assignable to type 'number'. c3({ b: true }); // Error, implied type is { b: number|string }. ~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'. +!!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: string | number; }'. !!! error TS2345: Types of property 'b' are incompatible. -!!! error TS2345: Type 'boolean' is not assignable to type 'number | string'. +!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'. c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]] ~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5.types b/tests/baselines/reference/destructuringParameterDeclaration3ES5.types index b8d48dcb9d4..d51a0e32dc8 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES5.types +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5.types @@ -23,8 +23,8 @@ type stringOrNumArray = Array; >Number : Number function a1(...x: (number|string)[]) { } ->a1 : (...x: (number | string)[]) => void ->x : (number | string)[] +>a1 : (...x: (string | number)[]) => void +>x : (string | number)[] function a2(...a) { } >a2 : (...a: any[]) => void @@ -75,8 +75,8 @@ var array = [1, 2, 3]; >3 : number var array2 = [true, false, "hello"]; ->array2 : (boolean | string)[] ->[true, false, "hello"] : (boolean | string)[] +>array2 : (string | boolean)[] +>[true, false, "hello"] : (string | boolean)[] >true : boolean >false : boolean >"hello" : string @@ -90,7 +90,7 @@ a2([...array]); a1(...array); >a1(...array) : void ->a1 : (...x: (number | string)[]) => void +>a1 : (...x: (string | number)[]) => void >...array : number >array : number[] @@ -109,7 +109,7 @@ a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]] a10([1, 2, [["string"]], false, true]); // Parameter type is any[] >a10([1, 2, [["string"]], false, true]) : void >a10 : ([a, b, [[c]], ...x]: Iterable) => void ->[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[] +>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[] >1 : number >2 : number >[["string"]] : string[][] diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.types b/tests/baselines/reference/destructuringParameterDeclaration3ES6.types index b439c4134ba..63d5d074a8d 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES6.types +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES6.types @@ -23,8 +23,8 @@ type stringOrNumArray = Array; >Number : Number function a1(...x: (number|string)[]) { } ->a1 : (...x: (number | string)[]) => void ->x : (number | string)[] +>a1 : (...x: (string | number)[]) => void +>x : (string | number)[] function a2(...a) { } >a2 : (...a: any[]) => void @@ -75,8 +75,8 @@ var array = [1, 2, 3]; >3 : number var array2 = [true, false, "hello"]; ->array2 : (boolean | string)[] ->[true, false, "hello"] : (boolean | string)[] +>array2 : (string | boolean)[] +>[true, false, "hello"] : (string | boolean)[] >true : boolean >false : boolean >"hello" : string @@ -90,7 +90,7 @@ a2([...array]); a1(...array); >a1(...array) : void ->a1 : (...x: (number | string)[]) => void +>a1 : (...x: (string | number)[]) => void >...array : number >array : number[] @@ -109,7 +109,7 @@ a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]] a10([1, 2, [["string"]], false, true]); // Parameter type is any[] >a10([1, 2, [["string"]], false, true]) : void >a10 : ([a, b, [[c]], ...x]: Iterable) => void ->[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[] +>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[] >1 : number >2 : number >[["string"]] : string[][] diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 89c771139ce..c89fa97b4cd 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -2,15 +2,15 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(13,13): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(14,17): error TS1047: A rest parameter cannot be optional. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(15,16): error TS1048: A rest parameter cannot have an initializer. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2304: Cannot find name 'array2'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,4): error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'. Types of property '2' are incompatible. Type 'string' is not assignable to type '[[any]]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'. Property '2' is missing in type '[number, number]'. -tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. - Type 'number | string' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(29,17): error TS1317: A parameter property cannot be declared using a rest parameter. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(34,22): error TS2304: Cannot find name 'E1'. @@ -47,7 +47,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] ~~~~ -!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2304: Cannot find name 'array2'. @@ -62,8 +62,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( !!! error TS2345: Property '2' is missing in type '[number, number]'. a6([1, 2, "string"]); // Error, parameter type is number[] ~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'number | string' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types index f8188147a79..c4693fac23f 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types @@ -84,8 +84,8 @@ var [...c1] = [1,2,3]; >3 : number var [...c2] = [1,2,3, "string"]; ->c2 : (number | string)[] ->[1,2,3, "string"] : (number | string)[] +>c2 : (string | number)[] +>[1,2,3, "string"] : (string | number)[] >1 : number >2 : number >3 : number @@ -113,9 +113,9 @@ var temp1 = [true, false, true] >true : boolean var [d3, d4] = [1, "string", ...temp1]; ->d3 : number | string | boolean ->d4 : number | string | boolean ->[1, "string", ...temp1] : (number | string | boolean)[] +>d3 : string | number | boolean +>d4 : string | number | boolean +>[1, "string", ...temp1] : (string | number | boolean)[] >1 : number >"string" : string >...temp1 : boolean diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types index 7b4fe5409db..847831ccc84 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types @@ -84,8 +84,8 @@ var [...c1] = [1,2,3]; >3 : number var [...c2] = [1,2,3, "string"]; ->c2 : (number | string)[] ->[1,2,3, "string"] : (number | string)[] +>c2 : (string | number)[] +>[1,2,3, "string"] : (string | number)[] >1 : number >2 : number >3 : number @@ -113,9 +113,9 @@ var temp1 = [true, false, true] >true : boolean var [d3, d4] = [1, "string", ...temp1]; ->d3 : number | string | boolean ->d4 : number | string | boolean ->[1, "string", ...temp1] : (number | string | boolean)[] +>d3 : string | number | boolean +>d4 : string | number | boolean +>[1, "string", ...temp1] : (string | number | boolean)[] >1 : number >"string" : string >...temp1 : boolean diff --git a/tests/baselines/reference/emitDecoratorMetadata_restArgs.types b/tests/baselines/reference/emitDecoratorMetadata_restArgs.types index 4820d3a7d8d..96605d0e7f2 100644 --- a/tests/baselines/reference/emitDecoratorMetadata_restArgs.types +++ b/tests/baselines/reference/emitDecoratorMetadata_restArgs.types @@ -1,15 +1,15 @@ === tests/cases/compiler/emitDecoratorMetadata_restArgs.ts === declare const MyClassDecorator: ClassDecorator; ->MyClassDecorator : (target: TFunction) => TFunction | void ->ClassDecorator : (target: TFunction) => TFunction | void +>MyClassDecorator : (target: TFunction) => void | TFunction +>ClassDecorator : (target: TFunction) => void | TFunction declare const MyMethodDecorator: MethodDecorator; ->MyMethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void ->MethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void +>MyMethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor +>MethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor @MyClassDecorator ->MyClassDecorator : (target: TFunction) => TFunction | void +>MyClassDecorator : (target: TFunction) => void | TFunction class A { >A : A @@ -18,7 +18,7 @@ class A { >args : any[] @MyMethodDecorator ->MyMethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void +>MyMethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor method(...args) {} >method : (...args: any[]) => void @@ -26,7 +26,7 @@ class A { } @MyClassDecorator ->MyClassDecorator : (target: TFunction) => TFunction | void +>MyClassDecorator : (target: TFunction) => void | TFunction class B { >B : B @@ -35,7 +35,7 @@ class B { >args : number[] @MyMethodDecorator ->MyMethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void +>MyMethodDecorator : (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => void | TypedPropertyDescriptor method(...args: string[]) {} >method : (...args: string[]) => void diff --git a/tests/baselines/reference/enumAssignmentCompat4.types b/tests/baselines/reference/enumAssignmentCompat4.types index db7f5ce8ba2..8d960245862 100644 --- a/tests/baselines/reference/enumAssignmentCompat4.types +++ b/tests/baselines/reference/enumAssignmentCompat4.types @@ -45,8 +45,8 @@ namespace N { } let broken = [ ->broken : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[] ->[ N.object1, M.object2] : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[] +>broken : ({ foo: M.MyEnum; } | { foo: N.MyEnum; })[] +>[ N.object1, M.object2] : ({ foo: M.MyEnum; } | { foo: N.MyEnum; })[] N.object1, >N.object1 : { foo: N.MyEnum; } diff --git a/tests/baselines/reference/enumBasics.types b/tests/baselines/reference/enumBasics.types index cecd8f51136..9e68b06bc3e 100644 --- a/tests/baselines/reference/enumBasics.types +++ b/tests/baselines/reference/enumBasics.types @@ -172,8 +172,8 @@ enum E9 { // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ ->doNotPropagate : (E8 | E7 | E4 | E3)[] ->[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E8 | E7 | E4 | E3)[] +>doNotPropagate : (E3 | E4 | E7 | E8)[] +>[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E3 | E4 | E7 | E8)[] E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z >E8.B : E8 @@ -198,8 +198,8 @@ var doNotPropagate = [ ]; // Enum computed members are not propagated var doPropagate = [ ->doPropagate : (E9 | E6 | E5)[] ->[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E9 | E6 | E5)[] +>doPropagate : (E5 | E6 | E9)[] +>[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E5 | E6 | E9)[] E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C >E9.A : E9 diff --git a/tests/baselines/reference/enumLiteralTypes1.types b/tests/baselines/reference/enumLiteralTypes1.types index 8e1f478baaa..f73f98e405b 100644 --- a/tests/baselines/reference/enumLiteralTypes1.types +++ b/tests/baselines/reference/enumLiteralTypes1.types @@ -13,14 +13,14 @@ type YesNo = Choice.Yes | Choice.No; >No : Choice.No type NoYes = Choice.No | Choice.Yes; ->NoYes : Choice.No | Choice.Yes +>NoYes : Choice.Yes | Choice.No >Choice : any >No : Choice.No >Choice : any >Yes : Choice.Yes type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No; ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown >Choice : any >Unknown : Choice.Unknown >Choice : any @@ -37,7 +37,7 @@ function f1() { var a: NoYes; >a : Choice.Yes | Choice.No ->NoYes : Choice.No | Choice.Yes +>NoYes : Choice.Yes | Choice.No var a: Choice.Yes | Choice.No; >a : Choice.Yes | Choice.No @@ -55,17 +55,17 @@ function f1() { } function f2(a: YesNo, b: UnknownYesNo, c: Choice) { ->f2 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void +>f2 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void >a : Choice.Yes | Choice.No >YesNo : Choice.Yes | Choice.No ->b : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown >c : Choice >Choice : Choice b = a; >b = a : Choice.Yes | Choice.No ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown >a : Choice.Yes | Choice.No c = a; @@ -234,11 +234,11 @@ declare function g(x: Choice): number; >Choice : Choice function f5(a: YesNo, b: UnknownYesNo, c: Choice) { ->f5 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void +>f5 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void >a : Choice.Yes | Choice.No >YesNo : Choice.Yes | Choice.No ->b : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown >c : Choice >Choice : Choice @@ -268,7 +268,7 @@ function f5(a: YesNo, b: UnknownYesNo, c: Choice) { >z4 : number >g(b) : number >g : { (x: Choice.Yes): string; (x: Choice.No): boolean; (x: Choice): number; } ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var z5 = g(c); >z5 : number @@ -336,30 +336,30 @@ function f11(x: YesNo) { } function f12(x: UnknownYesNo) { ->f12 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void ->x : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>f12 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void +>x : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown if (x) { ->x : Choice.Unknown | Choice.Yes | Choice.No +>x : Choice.Yes | Choice.No | Choice.Unknown x; >x : Choice.Yes | Choice.No } else { x; ->x : Choice.Unknown | Choice.Yes | Choice.No +>x : Choice.Yes | Choice.No | Choice.Unknown } } function f13(x: UnknownYesNo) { ->f13 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void ->x : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>f13 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void +>x : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown if (x === Choice.Yes) { >x === Choice.Yes : boolean ->x : Choice.Unknown | Choice.Yes | Choice.No +>x : Choice.Yes | Choice.No | Choice.Unknown >Choice.Yes : Choice.Yes >Choice : typeof Choice >Yes : Choice.Yes @@ -369,7 +369,7 @@ function f13(x: UnknownYesNo) { } else { x; ->x : Choice.Unknown | Choice.No +>x : Choice.No | Choice.Unknown } } diff --git a/tests/baselines/reference/enumLiteralTypes2.types b/tests/baselines/reference/enumLiteralTypes2.types index aab06c82fc4..45f5853d140 100644 --- a/tests/baselines/reference/enumLiteralTypes2.types +++ b/tests/baselines/reference/enumLiteralTypes2.types @@ -14,14 +14,14 @@ type YesNo = Choice.Yes | Choice.No; >No : Choice.No type NoYes = Choice.No | Choice.Yes; ->NoYes : Choice.No | Choice.Yes +>NoYes : Choice.Yes | Choice.No >Choice : any >No : Choice.No >Choice : any >Yes : Choice.Yes type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No; ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown >Choice : any >Unknown : Choice.Unknown >Choice : any @@ -38,7 +38,7 @@ function f1() { var a: NoYes; >a : Choice.Yes | Choice.No ->NoYes : Choice.No | Choice.Yes +>NoYes : Choice.Yes | Choice.No var a: Choice.Yes | Choice.No; >a : Choice.Yes | Choice.No @@ -56,17 +56,17 @@ function f1() { } function f2(a: YesNo, b: UnknownYesNo, c: Choice) { ->f2 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void +>f2 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void >a : Choice.Yes | Choice.No >YesNo : Choice.Yes | Choice.No ->b : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown >c : Choice >Choice : Choice b = a; >b = a : Choice.Yes | Choice.No ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown >a : Choice.Yes | Choice.No c = a; @@ -81,132 +81,132 @@ function f2(a: YesNo, b: UnknownYesNo, c: Choice) { } function f3(a: Choice.Yes, b: UnknownYesNo) { ->f3 : (a: Choice.Yes, b: Choice.Unknown | Choice.Yes | Choice.No) => void +>f3 : (a: Choice.Yes, b: Choice.Yes | Choice.No | Choice.Unknown) => void >a : Choice.Yes >Choice : any >Yes : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown var x = a + b; >x : number >a + b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = a - b; >x : number >a - b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = a * b; >x : number >a * b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = a / b; >x : number >a / b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = a % b; >x : number >a % b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = a | b; >x : number >a | b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = a & b; >x : number >a & b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = a ^ b; >x : number >a ^ b : number >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = -b; >x : number >-b : number ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var x = ~b; >x : number >~b : number ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a == b; >y : boolean >a == b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a != b; >y : boolean >a != b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a === b; >y : boolean >a === b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a !== b; >y : boolean >a !== b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a > b; >y : boolean >a > b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a < b; >y : boolean >a < b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a >= b; >y : boolean >a >= b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = a <= b; >y : boolean >a <= b : boolean >a : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var y = !b; >y : boolean >!b : boolean ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown } function f4(a: Choice.Yes, b: UnknownYesNo) { ->f4 : (a: Choice.Yes, b: Choice.Unknown | Choice.Yes | Choice.No) => void +>f4 : (a: Choice.Yes, b: Choice.Yes | Choice.No | Choice.Unknown) => void >a : Choice.Yes >Choice : any >Yes : Choice.Yes ->b : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown a++; >a++ : number @@ -214,7 +214,7 @@ function f4(a: Choice.Yes, b: UnknownYesNo) { b++; >b++ : number ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown } declare function g(x: Choice.Yes): string; @@ -235,11 +235,11 @@ declare function g(x: Choice): number; >Choice : Choice function f5(a: YesNo, b: UnknownYesNo, c: Choice) { ->f5 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void +>f5 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void >a : Choice.Yes | Choice.No >YesNo : Choice.Yes | Choice.No ->b : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown >c : Choice >Choice : Choice @@ -269,7 +269,7 @@ function f5(a: YesNo, b: UnknownYesNo, c: Choice) { >z4 : number >g(b) : number >g : { (x: Choice.Yes): string; (x: Choice.No): boolean; (x: Choice): number; } ->b : Choice.Unknown | Choice.Yes | Choice.No +>b : Choice.Yes | Choice.No | Choice.Unknown var z5 = g(c); >z5 : number @@ -337,12 +337,12 @@ function f11(x: YesNo) { } function f12(x: UnknownYesNo) { ->f12 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void ->x : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>f12 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void +>x : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown if (x) { ->x : Choice.Unknown | Choice.Yes | Choice.No +>x : Choice.Yes | Choice.No | Choice.Unknown x; >x : Choice.Yes | Choice.No @@ -354,13 +354,13 @@ function f12(x: UnknownYesNo) { } function f13(x: UnknownYesNo) { ->f13 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void ->x : Choice.Unknown | Choice.Yes | Choice.No ->UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No +>f13 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void +>x : Choice.Yes | Choice.No | Choice.Unknown +>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown if (x === Choice.Yes) { >x === Choice.Yes : boolean ->x : Choice.Unknown | Choice.Yes | Choice.No +>x : Choice.Yes | Choice.No | Choice.Unknown >Choice.Yes : Choice.Yes >Choice : typeof Choice >Yes : Choice.Yes @@ -370,7 +370,7 @@ function f13(x: UnknownYesNo) { } else { x; ->x : Choice.Unknown | Choice.No +>x : Choice.No | Choice.Unknown } } diff --git a/tests/baselines/reference/enumLiteralTypes3.errors.txt b/tests/baselines/reference/enumLiteralTypes3.errors.txt index 2f3ea5ada24..bfc8d5ac0d0 100644 --- a/tests/baselines/reference/enumLiteralTypes3.errors.txt +++ b/tests/baselines/reference/enumLiteralTypes3.errors.txt @@ -1,12 +1,12 @@ tests/cases/conformance/types/literal/enumLiteralTypes3.ts(10,5): error TS2322: Type 'Yes | No' is not assignable to type 'Yes'. Type 'No' is not assignable to type 'Yes'. -tests/cases/conformance/types/literal/enumLiteralTypes3.ts(11,5): error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes'. - Type 'Unknown' is not assignable to type 'Yes'. +tests/cases/conformance/types/literal/enumLiteralTypes3.ts(11,5): error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes'. + Type 'No' is not assignable to type 'Yes'. tests/cases/conformance/types/literal/enumLiteralTypes3.ts(12,5): error TS2322: Type 'Choice' is not assignable to type 'Yes'. -tests/cases/conformance/types/literal/enumLiteralTypes3.ts(18,5): error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes | No'. +tests/cases/conformance/types/literal/enumLiteralTypes3.ts(18,5): error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes | No'. Type 'Unknown' is not assignable to type 'Yes | No'. tests/cases/conformance/types/literal/enumLiteralTypes3.ts(19,5): error TS2322: Type 'Choice' is not assignable to type 'Yes | No'. -tests/cases/conformance/types/literal/enumLiteralTypes3.ts(26,5): error TS2322: Type 'Choice' is not assignable to type 'Unknown | Yes | No'. +tests/cases/conformance/types/literal/enumLiteralTypes3.ts(26,5): error TS2322: Type 'Choice' is not assignable to type 'Yes | No | Unknown'. tests/cases/conformance/types/literal/enumLiteralTypes3.ts(37,5): error TS2322: Type 'Unknown' is not assignable to type 'Yes'. tests/cases/conformance/types/literal/enumLiteralTypes3.ts(39,5): error TS2322: Type 'No' is not assignable to type 'Yes'. tests/cases/conformance/types/literal/enumLiteralTypes3.ts(40,5): error TS2322: Type 'Unknown' is not assignable to type 'Yes | No'. @@ -34,8 +34,8 @@ tests/cases/conformance/types/literal/enumLiteralTypes3.ts(96,14): error TS2678: !!! error TS2322: Type 'No' is not assignable to type 'Yes'. a = c; ~ -!!! error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes'. -!!! error TS2322: Type 'Unknown' is not assignable to type 'Yes'. +!!! error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes'. +!!! error TS2322: Type 'No' is not assignable to type 'Yes'. a = d; ~ !!! error TS2322: Type 'Choice' is not assignable to type 'Yes'. @@ -46,7 +46,7 @@ tests/cases/conformance/types/literal/enumLiteralTypes3.ts(96,14): error TS2678: b = b; b = c; ~ -!!! error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes | No'. +!!! error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes | No'. !!! error TS2322: Type 'Unknown' is not assignable to type 'Yes | No'. b = d; ~ @@ -59,7 +59,7 @@ tests/cases/conformance/types/literal/enumLiteralTypes3.ts(96,14): error TS2678: c = c; c = d; ~ -!!! error TS2322: Type 'Choice' is not assignable to type 'Unknown | Yes | No'. +!!! error TS2322: Type 'Choice' is not assignable to type 'Yes | No | Unknown'. } function f4(a: Yes, b: YesNo, c: UnknownYesNo, d: Choice) { diff --git a/tests/baselines/reference/for-of11.errors.txt b/tests/baselines/reference/for-of11.errors.txt index 7c00e454d4e..dc527e73efe 100644 --- a/tests/baselines/reference/for-of11.errors.txt +++ b/tests/baselines/reference/for-of11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'number | string' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -6,5 +6,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Typ var v: string; for (v of [0, ""]) { } ~ -!!! error TS2322: Type 'number | string' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of12.errors.txt b/tests/baselines/reference/for-of12.errors.txt index 6100564ba58..f19fa5ed014 100644 --- a/tests/baselines/reference/for-of12.errors.txt +++ b/tests/baselines/reference/for-of12.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'number | string' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -6,5 +6,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Typ var v: string; for (v of [0, ""].values()) { } ~ -!!! error TS2322: Type 'number | string' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/functionImplementations.types b/tests/baselines/reference/functionImplementations.types index 6690ca68c98..6cb1cde1c82 100644 --- a/tests/baselines/reference/functionImplementations.types +++ b/tests/baselines/reference/functionImplementations.types @@ -325,7 +325,7 @@ class AnotherClass { private x } var f7: (x: number) => string | number = x => { // should be (x: number) => number | string >f7 : (x: number) => string | number >x : number ->x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => number | string +>x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => string | number >x : number if (x < 0) { return x; } diff --git a/tests/baselines/reference/functionOverloads43.types b/tests/baselines/reference/functionOverloads43.types index 7c0fa8eb818..e48ffd41f60 100644 --- a/tests/baselines/reference/functionOverloads43.types +++ b/tests/baselines/reference/functionOverloads43.types @@ -11,16 +11,16 @@ function foo(bar: { a:string }[]): string; function foo([x]: { a:number | string }[]): string | number { >foo : { (bar: { a: number; }[]): number; (bar: { a: string; }[]): string; } ->x : { a: number | string; } ->a : number | string +>x : { a: string | number; } +>a : string | number if (x) { ->x : { a: number | string; } +>x : { a: string | number; } return x.a; ->x.a : number | string ->x : { a: number | string; } ->a : number | string +>x.a : string | number +>x : { a: string | number; } +>a : string | number } return undefined; diff --git a/tests/baselines/reference/functionOverloads44.types b/tests/baselines/reference/functionOverloads44.types index 56cad09b472..48fcfa3371b 100644 --- a/tests/baselines/reference/functionOverloads44.types +++ b/tests/baselines/reference/functionOverloads44.types @@ -27,8 +27,8 @@ function foo1(bar: { a:string }[]): Animal; function foo1([x]: { a:number | string }[]): Dog { >foo1 : { (bar: { a: number; }[]): Dog; (bar: { a: string; }[]): Animal; } ->x : { a: number | string; } ->a : number | string +>x : { a: string | number; } +>a : string | number >Dog : Dog return undefined; @@ -36,22 +36,22 @@ function foo1([x]: { a:number | string }[]): Dog { } function foo2(bar: { a:number }[]): Cat; ->foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; } +>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; } >bar : { a: number; }[] >a : number >Cat : Cat function foo2(bar: { a:string }[]): Cat | Dog; ->foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; } +>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; } >bar : { a: string; }[] >a : string >Cat : Cat >Dog : Dog function foo2([x]: { a:number | string }[]): Cat { ->foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; } ->x : { a: number | string; } ->a : number | string +>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; } +>x : { a: string | number; } +>a : string | number >Cat : Cat return undefined; @@ -78,9 +78,9 @@ var y1 = foo1([{a: 100}]); >100 : number var x2 = foo2([{a: "str"}]); ->x2 : Cat | Dog ->foo2([{a: "str"}]) : Cat | Dog ->foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; } +>x2 : Dog | Cat +>foo2([{a: "str"}]) : Dog | Cat +>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; } >[{a: "str"}] : { a: string; }[] >{a: "str"} : { a: string; } >a : string @@ -89,7 +89,7 @@ var x2 = foo2([{a: "str"}]); var y2 = foo2([{a: 100}]); >y2 : Cat >foo2([{a: 100}]) : Cat ->foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; } +>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; } >[{a: 100}] : { a: number; }[] >{a: 100} : { a: number; } >a : number diff --git a/tests/baselines/reference/functionOverloads45.types b/tests/baselines/reference/functionOverloads45.types index 257a615e334..29eb55a40ed 100644 --- a/tests/baselines/reference/functionOverloads45.types +++ b/tests/baselines/reference/functionOverloads45.types @@ -27,8 +27,8 @@ function foo1(bar: { a:string }[]): Dog; function foo1([x]: { a:number | string }[]): Animal { >foo1 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog; } ->x : { a: number | string; } ->a : number | string +>x : { a: string | number; } +>a : string | number >Animal : Animal return undefined; @@ -49,8 +49,8 @@ function foo2(bar: { a:string }[]): Dog; function foo2([x]: { a:number | string }[]): Cat | Dog { >foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog; } ->x : { a: number | string; } ->a : number | string +>x : { a: string | number; } +>a : string | number >Cat : Cat >Dog : Dog diff --git a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types index 5c7500fb5ed..c5fd984d327 100644 --- a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types +++ b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types @@ -49,7 +49,7 @@ _.all([true, 1, null, 'yes'], _.identity); >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => boolean >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => boolean ->[true, 1, null, 'yes'] : (boolean | number | string)[] +>[true, 1, null, 'yes'] : (string | number | boolean)[] >true : boolean >1 : number >null : null diff --git a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types index c8e8b41b5fd..48a7150ef44 100644 --- a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types +++ b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types @@ -46,10 +46,10 @@ var r3 = foo([]); // number[] >[] : undefined[] var r4 = foo([1, '']); // {}[] ->r4 : (number | string)[] ->foo([1, '']) : (number | string)[] +>r4 : (string | number)[] +>foo([1, '']) : (string | number)[] >foo : (t: T) => T ->[1, ''] : (number | string)[] +>[1, ''] : (string | number)[] >1 : number >'' : string @@ -57,7 +57,7 @@ var r5 = foo([1, '']); // any[] >r5 : any[] >foo([1, '']) : any[] >foo : (t: T) => T ->[1, ''] : (number | string)[] +>[1, ''] : (string | number)[] >1 : number >'' : string @@ -66,7 +66,7 @@ var r6 = foo([1, '']); // Object[] >foo([1, '']) : Object[] >foo : (t: T) => T >Object : Object ->[1, ''] : (number | string)[] +>[1, ''] : (string | number)[] >1 : number >'' : string diff --git a/tests/baselines/reference/genericTypeArgumentInference1.types b/tests/baselines/reference/genericTypeArgumentInference1.types index 405c328bc45..2d64c8f5c58 100644 --- a/tests/baselines/reference/genericTypeArgumentInference1.types +++ b/tests/baselines/reference/genericTypeArgumentInference1.types @@ -42,12 +42,12 @@ declare var _: Underscore.Static; >Static : Underscore.Static var r = _.all([true, 1, null, 'yes'], _.identity); ->r : boolean | number | string ->_.all([true, 1, null, 'yes'], _.identity) : boolean | number | string +>r : string | number | boolean +>_.all([true, 1, null, 'yes'], _.identity) : string | number | boolean >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T ->[true, 1, null, 'yes'] : (boolean | number | string)[] +>[true, 1, null, 'yes'] : (string | number | boolean)[] >true : boolean >1 : number >null : null diff --git a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt index 20e113faf2a..e5c2be7a598 100644 --- a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt +++ b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'string[]'. - Type 'number | string' is not assignable to type 'string'. +tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'string[]'. + Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -14,8 +14,8 @@ tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argu this.test([]); this.test([1, 2, "hi", 5]); // Error ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'string[]'. -!!! error TS2345: Type 'number | string' is not assignable to type 'string'. +!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'string[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'string'. !!! error TS2345: Type 'number' is not assignable to type 'string'. } } \ No newline at end of file diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types b/tests/baselines/reference/heterogeneousArrayLiterals.types index c760e5a566f..026e9c26bae 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.types +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types @@ -2,8 +2,8 @@ // type of an array is the best common type of its elements (plus its contextual type if it exists) var a = [1, '']; // {}[] ->a : (number | string)[] ->[1, ''] : (number | string)[] +>a : (string | number)[] +>[1, ''] : (string | number)[] >1 : number >'' : string @@ -14,8 +14,8 @@ var b = [1, null]; // number[] >null : null var c = [1, '', null]; // {}[] ->c : (number | string)[] ->[1, '', null] : (number | string)[] +>c : (string | number)[] +>[1, '', null] : (string | number)[] >1 : number >'' : string >null : null @@ -296,8 +296,8 @@ function foo(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (T | number)[] ->[t, 1] : (T | number)[] +>d : (number | T)[] +>[t, 1] : (number | T)[] >t : T >1 : number @@ -350,8 +350,8 @@ function foo2(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (T | number)[] ->[t, 1] : (T | number)[] +>d : (number | T)[] +>[t, 1] : (number | T)[] >t : T >1 : number @@ -380,8 +380,8 @@ function foo2(t: T, u: U) { >base : Base var h = [t, derived]; // Derived[] ->h : (T | Derived)[] ->[t, derived] : (T | Derived)[] +>h : (Derived | T)[] +>[t, derived] : (Derived | T)[] >t : T >derived : Derived @@ -428,8 +428,8 @@ function foo3(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (T | number)[] ->[t, 1] : (T | number)[] +>d : (number | T)[] +>[t, 1] : (number | T)[] >t : T >1 : number @@ -506,8 +506,8 @@ function foo4(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (T | number)[] ->[t, 1] : (T | number)[] +>d : (number | T)[] +>[t, 1] : (number | T)[] >t : T >1 : number @@ -536,8 +536,8 @@ function foo4(t: T, u: U) { >base : Base var h = [t, derived]; // Derived[] ->h : (T | Derived)[] ->[t, derived] : (T | Derived)[] +>h : (Derived | T)[] +>[t, derived] : (Derived | T)[] >t : T >derived : Derived @@ -548,8 +548,8 @@ function foo4(t: T, u: U) { >base : Base var j = [u, derived]; // Derived[] ->j : (U | Derived)[] ->[u, derived] : (U | Derived)[] +>j : (Derived | U)[] +>[u, derived] : (Derived | U)[] >u : U >derived : Derived diff --git a/tests/baselines/reference/implicitIndexSignatures.types b/tests/baselines/reference/implicitIndexSignatures.types index 7d335c00491..6d670c6341b 100644 --- a/tests/baselines/reference/implicitIndexSignatures.types +++ b/tests/baselines/reference/implicitIndexSignatures.types @@ -147,14 +147,14 @@ function f3() { >b : string const v1 = getStringIndexValue(o1); ->v1 : number | string ->getStringIndexValue(o1) : number | string +>v1 : string | number +>getStringIndexValue(o1) : string | number >getStringIndexValue : (map: { [x: string]: T; }) => T >o1 : { a: number; b: string; } const v2 = getStringIndexValue(o2); ->v2 : number | string ->getStringIndexValue(o2) : number | string +>v2 : string | number +>getStringIndexValue(o2) : string | number >getStringIndexValue : (map: { [x: string]: T; }) => T >o2 : { a: number; b: string; } } diff --git a/tests/baselines/reference/indexerWithTuple.types b/tests/baselines/reference/indexerWithTuple.types index 7605fba0518..4faae2cda29 100644 --- a/tests/baselines/reference/indexerWithTuple.types +++ b/tests/baselines/reference/indexerWithTuple.types @@ -101,20 +101,20 @@ var eleUnion11 = unionTuple1[1]; // string | number >1 : number var eleUnion12 = unionTuple1[2]; // string | number ->eleUnion12 : number | string ->unionTuple1[2] : number | string +>eleUnion12 : string | number +>unionTuple1[2] : string | number >unionTuple1 : [number, string | number] >2 : number var eleUnion13 = unionTuple1[idx0]; // string | number ->eleUnion13 : number | string ->unionTuple1[idx0] : number | string +>eleUnion13 : string | number +>unionTuple1[idx0] : string | number >unionTuple1 : [number, string | number] >idx0 : number var eleUnion14 = unionTuple1[idx1]; // string | number ->eleUnion14 : number | string ->unionTuple1[idx1] : number | string +>eleUnion14 : string | number +>unionTuple1[idx1] : string | number >unionTuple1 : [number, string | number] >idx1 : number @@ -143,20 +143,20 @@ var eleUnion21 = unionTuple2[1]; // string | number >1 : number var eleUnion22 = unionTuple2[2]; // string | number | boolean ->eleUnion22 : boolean | string | number ->unionTuple2[2] : boolean | string | number +>eleUnion22 : string | number | boolean +>unionTuple2[2] : string | number | boolean >unionTuple2 : [boolean, string | number] >2 : number var eleUnion23 = unionTuple2[idx0]; // string | number | boolean ->eleUnion23 : boolean | string | number ->unionTuple2[idx0] : boolean | string | number +>eleUnion23 : string | number | boolean +>unionTuple2[idx0] : string | number | boolean >unionTuple2 : [boolean, string | number] >idx0 : number var eleUnion24 = unionTuple2[idx1]; // string | number | boolean ->eleUnion24 : boolean | string | number ->unionTuple2[idx1] : boolean | string | number +>eleUnion24 : string | number | boolean +>unionTuple2[idx1] : string | number | boolean >unionTuple2 : [boolean, string | number] >idx1 : number diff --git a/tests/baselines/reference/instanceOfAssignability.types b/tests/baselines/reference/instanceOfAssignability.types index 44ec45e2069..192db8bcd1b 100644 --- a/tests/baselines/reference/instanceOfAssignability.types +++ b/tests/baselines/reference/instanceOfAssignability.types @@ -46,14 +46,14 @@ class Giraffe extends Mammal { neck; } >neck : any function fn1(x: Array|Array|boolean) { ->fn1 : (x: number[] | string[] | boolean) => void ->x : number[] | string[] | boolean +>fn1 : (x: boolean | number[] | string[]) => void +>x : boolean | number[] | string[] >Array : T[] >Array : T[] if(x instanceof Array) { >x instanceof Array : boolean ->x : number[] | string[] | boolean +>x : boolean | number[] | string[] >Array : ArrayConstructor // 1.5: y: Array|Array diff --git a/tests/baselines/reference/iteratorSpreadInCall12.types b/tests/baselines/reference/iteratorSpreadInCall12.types index 5e3e7bcdbc4..8543e59f55f 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.types +++ b/tests/baselines/reference/iteratorSpreadInCall12.types @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts === new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); ->new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo +>new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo >Foo : typeof Foo ->...[...new SymbolIterator, ...[...new StringIterator]] : symbol | string ->[...new SymbolIterator, ...[...new StringIterator]] : (symbol | string)[] +>...[...new SymbolIterator, ...[...new StringIterator]] : string | symbol +>[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[] >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator >SymbolIterator : typeof SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInCall5.types b/tests/baselines/reference/iteratorSpreadInCall5.types index 043536ab4c0..bf4a0f7ad65 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.types +++ b/tests/baselines/reference/iteratorSpreadInCall5.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts === foo(...new SymbolIterator, ...new StringIterator); >foo(...new SymbolIterator, ...new StringIterator) : void ->foo : (...s: (symbol | string)[]) => void +>foo : (...s: (string | symbol)[]) => void >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator >SymbolIterator : typeof SymbolIterator @@ -10,8 +10,8 @@ foo(...new SymbolIterator, ...new StringIterator); >StringIterator : typeof StringIterator function foo(...s: (symbol | string)[]) { } ->foo : (...s: (symbol | string)[]) => void ->s : (symbol | string)[] +>foo : (...s: (string | symbol)[]) => void +>s : (string | symbol)[] class SymbolIterator { >SymbolIterator : SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt index ee9945f7af6..93aaec8c330 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. +tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts (1 errors) ==== foo(...new SymbolIterator, ...new StringIterator); ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. function foo(...s: (symbol | number)[]) { } class SymbolIterator { diff --git a/tests/baselines/reference/json.stringify.types b/tests/baselines/reference/json.stringify.types index 7cce2d3ed24..aaf92a17c0a 100644 --- a/tests/baselines/reference/json.stringify.types +++ b/tests/baselines/reference/json.stringify.types @@ -6,27 +6,27 @@ var value = null; JSON.stringify(value, undefined, 2); >JSON.stringify(value, undefined, 2) : string ->JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >JSON : JSON ->stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >value : null >undefined : undefined >2 : number JSON.stringify(value, null, 2); >JSON.stringify(value, null, 2) : string ->JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >JSON : JSON ->stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >value : null >null : null >2 : number JSON.stringify(value, ["a", 1], 2); >JSON.stringify(value, ["a", 1], 2) : string ->JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >JSON : JSON ->stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >value : null >["a", 1] : (string | number)[] >"a" : string @@ -35,9 +35,9 @@ JSON.stringify(value, ["a", 1], 2); JSON.stringify(value, (k) => undefined, 2); >JSON.stringify(value, (k) => undefined, 2) : string ->JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >JSON : JSON ->stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >value : null >(k) => undefined : (k: string) => undefined >k : string @@ -46,9 +46,9 @@ JSON.stringify(value, (k) => undefined, 2); JSON.stringify(value, undefined, 2); >JSON.stringify(value, undefined, 2) : string ->JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >JSON : JSON ->stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; } +>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; } >value : null >undefined : undefined >2 : number diff --git a/tests/baselines/reference/literalTypes1.types b/tests/baselines/reference/literalTypes1.types index e7a44f8d753..d34b5aebf9c 100644 --- a/tests/baselines/reference/literalTypes1.types +++ b/tests/baselines/reference/literalTypes1.types @@ -79,34 +79,34 @@ function f2(x: 0 | 1 | 2) { } type Falsy = false | 0 | "" | null | undefined; ->Falsy : false | 0 | "" | null | undefined +>Falsy : false | "" | 0 | null | undefined >false : false >null : null function f3(x: Falsy) { ->f3 : (x: false | 0 | "" | null | undefined) => void ->x : false | 0 | "" | null | undefined ->Falsy : false | 0 | "" | null | undefined +>f3 : (x: false | "" | 0 | null | undefined) => void +>x : false | "" | 0 | null | undefined +>Falsy : false | "" | 0 | null | undefined if (x) { ->x : false | 0 | "" | null | undefined +>x : false | "" | 0 | null | undefined x; >x : never } else { x; ->x : false | 0 | "" | null | undefined +>x : false | "" | 0 | null | undefined } } function f4(x: 0 | 1 | true | string) { ->f4 : (x: 0 | 1 | true | string) => void ->x : 0 | 1 | true | string +>f4 : (x: string | true | 0 | 1) => void +>x : string | true | 0 | 1 >true : true switch (x) { ->x : 0 | 1 | true | string +>x : string | true | 0 | 1 case 0: >0 : 0 @@ -148,7 +148,7 @@ function f4(x: 0 | 1 | true | string) { break; default: x; ->x : true | string +>x : string | true } } diff --git a/tests/baselines/reference/logicalAndOperatorStrictMode.types b/tests/baselines/reference/logicalAndOperatorStrictMode.types index c47c54ad1b7..a2321b06958 100644 --- a/tests/baselines/reference/logicalAndOperatorStrictMode.types +++ b/tests/baselines/reference/logicalAndOperatorStrictMode.types @@ -86,8 +86,8 @@ const a8 = a && z; >z : string | number | undefined const s1 = s && a; ->s1 : number[] | "" ->s && a : number[] | "" +>s1 : "" | number[] +>s && a : "" | number[] >s : string >a : number[] @@ -134,8 +134,8 @@ const s8 = s && z; >z : string | number | undefined const x1 = x && a; ->x1 : number[] | 0 ->x && a : number[] | 0 +>x1 : 0 | number[] +>x && a : 0 | number[] >x : number >a : number[] @@ -182,8 +182,8 @@ const x8 = x && z; >z : string | number | undefined const b1 = b && a; ->b1 : number[] | false ->b && a : number[] | false +>b1 : false | number[] +>b && a : false | number[] >b : boolean >a : number[] @@ -206,8 +206,8 @@ const b4 = b && b; >b : true const b5 = b && v; ->b5 : void | false ->b && v : void | false +>b5 : false | void +>b && v : false | void >b : boolean >v : void @@ -374,8 +374,8 @@ const n8 = n && z; >z : string | number | undefined const z1 = z && a; ->z1 : number[] | "" | 0 | undefined ->z && a : number[] | "" | 0 | undefined +>z1 : "" | 0 | number[] | undefined +>z && a : "" | 0 | number[] | undefined >z : string | number | undefined >a : number[] diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index 4a8f5e6a3e1..8f2f4af0698 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -127,20 +127,20 @@ var rb5 = a5 || a2; // void || boolean is void | boolean >a2 : boolean var rb6 = a6 || a2; // enum || boolean is E | boolean ->rb6 : E | boolean ->a6 || a2 : E | boolean +>rb6 : boolean | E +>a6 || a2 : boolean | E >a6 : E >a2 : boolean var rb7 = a7 || a2; // object || boolean is object | boolean ->rb7 : { a: string; } | boolean ->a7 || a2 : { a: string; } | boolean +>rb7 : boolean | { a: string; } +>a7 || a2 : boolean | { a: string; } >a7 : { a: string; } >a2 : boolean var rb8 = a8 || a2; // array || boolean is array | boolean ->rb8 : string[] | boolean ->a8 || a2 : string[] | boolean +>rb8 : boolean | string[] +>a8 || a2 : boolean | string[] >a8 : string[] >a2 : boolean @@ -163,8 +163,8 @@ var rc1 = a1 || a3; // any || number is any >a3 : number var rc2 = a2 || a3; // boolean || number is boolean | number ->rc2 : true | number ->a2 || a3 : true | number +>rc2 : number | true +>a2 || a3 : number | true >a2 : boolean >a3 : number @@ -193,14 +193,14 @@ var rc6 = a6 || a3; // enum || number is number >a3 : number var rc7 = a7 || a3; // object || number is object | number ->rc7 : { a: string; } | number ->a7 || a3 : { a: string; } | number +>rc7 : number | { a: string; } +>a7 || a3 : number | { a: string; } >a7 : { a: string; } >a3 : number var rc8 = a8 || a3; // array || number is array | number ->rc8 : string[] | number ->a8 || a3 : string[] | number +>rc8 : number | string[] +>a8 || a3 : number | string[] >a8 : string[] >a3 : number @@ -223,14 +223,14 @@ var rd1 = a1 || a4; // any || string is any >a4 : string var rd2 = a2 || a4; // boolean || string is boolean | string ->rd2 : true | string ->a2 || a4 : true | string +>rd2 : string | true +>a2 || a4 : string | true >a2 : boolean >a4 : string var rd3 = a3 || a4; // number || string is number | string ->rd3 : number | string ->a3 || a4 : number | string +>rd3 : string | number +>a3 || a4 : string | number >a3 : number >a4 : string @@ -247,20 +247,20 @@ var rd5 = a5 || a4; // void || string is void | string >a4 : string var rd6 = a6 || a4; // enum || string is enum | string ->rd6 : E | string ->a6 || a4 : E | string +>rd6 : string | E +>a6 || a4 : string | E >a6 : E >a4 : string var rd7 = a7 || a4; // object || string is object | string ->rd7 : { a: string; } | string ->a7 || a4 : { a: string; } | string +>rd7 : string | { a: string; } +>a7 || a4 : string | { a: string; } >a7 : { a: string; } >a4 : string var rd8 = a8 || a4; // array || string is array | string ->rd8 : string[] | string ->a8 || a4 : string[] | string +>rd8 : string | string[] +>a8 || a4 : string | string[] >a8 : string[] >a4 : string @@ -307,20 +307,20 @@ var re5 = a5 || a5; // void || void is void >a5 : void var re6 = a6 || a5; // enum || void is enum | void ->re6 : E | void ->a6 || a5 : E | void +>re6 : void | E +>a6 || a5 : void | E >a6 : E >a5 : void var re7 = a7 || a5; // object || void is object | void ->re7 : { a: string; } | void ->a7 || a5 : { a: string; } | void +>re7 : void | { a: string; } +>a7 || a5 : void | { a: string; } >a7 : { a: string; } >a5 : void var re8 = a8 || a5; // array || void is array | void ->re8 : string[] | void ->a8 || a5 : string[] | void +>re8 : void | string[] +>a8 || a5 : void | string[] >a8 : string[] >a5 : void @@ -373,14 +373,14 @@ var rg6 = a6 || a6; // enum || enum is E >a6 : E var rg7 = a7 || a6; // object || enum is object | enum ->rg7 : { a: string; } | E ->a7 || a6 : { a: string; } | E +>rg7 : E | { a: string; } +>a7 || a6 : E | { a: string; } >a7 : { a: string; } >a6 : E var rg8 = a8 || a6; // array || enum is array | enum ->rg8 : string[] | E ->a8 || a6 : string[] | E +>rg8 : E | string[] +>a8 || a6 : E | string[] >a8 : string[] >a6 : E @@ -439,8 +439,8 @@ var rh7 = a7 || a7; // object || object is object >a7 : { a: string; } var rh8 = a8 || a7; // array || object is array | object ->rh8 : string[] | { a: string; } ->a8 || a7 : string[] | { a: string; } +>rh8 : { a: string; } | string[] +>a8 || a7 : { a: string; } | string[] >a8 : string[] >a7 : { a: string; } diff --git a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt index e8649cfb567..2fb7bd1bfbb 100644 --- a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt +++ b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. - Type 'number | string' is not assignable to type 'number'. +tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2346: Supplied parameters do not match any signature of call target. @@ -16,8 +16,8 @@ tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): e var r6 = map([1, ""], (x) => x.toString()); var r7 = map([1, ""], (x) => x.toString()); // error ~~~~~~~ -!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'number | string' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. var r7b = map([1, ""], (x) => x.toString()); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/narrowTypeByInstanceof.types b/tests/baselines/reference/narrowTypeByInstanceof.types index 8bc13d12ca1..b98b1e4d234 100644 --- a/tests/baselines/reference/narrowTypeByInstanceof.types +++ b/tests/baselines/reference/narrowTypeByInstanceof.types @@ -22,24 +22,24 @@ } type FileMatchOrMatch = FileMatch | Match; ->FileMatchOrMatch : FileMatch | Match +>FileMatchOrMatch : Match | FileMatch >FileMatch : FileMatch >Match : Match let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch; ->elementA : FileMatch | Match ->FileMatchOrMatch : FileMatch | Match ->elementB : FileMatch | Match ->FileMatchOrMatch : FileMatch | Match +>elementA : Match | FileMatch +>FileMatchOrMatch : Match | FileMatch +>elementB : Match | FileMatch +>FileMatchOrMatch : Match | FileMatch if (elementA instanceof FileMatch && elementB instanceof FileMatch) { >elementA instanceof FileMatch && elementB instanceof FileMatch : boolean >elementA instanceof FileMatch : boolean ->elementA : FileMatch | Match +>elementA : Match | FileMatch >FileMatch : typeof FileMatch >elementB instanceof FileMatch : boolean ->elementB : FileMatch | Match +>elementB : Match | FileMatch >FileMatch : typeof FileMatch let a = elementA.resource().path; @@ -66,7 +66,7 @@ if (elementA instanceof FileMatch && elementB instanceof FileMatch) { >elementA : Match | FileMatch >Match : typeof Match >elementB instanceof Match : boolean ->elementB : FileMatch | Match +>elementB : Match | FileMatch >Match : typeof Match let a = elementA.range(); diff --git a/tests/baselines/reference/numericLiteralTypes1.types b/tests/baselines/reference/numericLiteralTypes1.types index f5632c2fa71..277148b1afb 100644 --- a/tests/baselines/reference/numericLiteralTypes1.types +++ b/tests/baselines/reference/numericLiteralTypes1.types @@ -44,17 +44,17 @@ function f1() { } type B1 = -1 | 0 | 1; ->B1 : -1 | 0 | 1 +>B1 : 0 | 1 | -1 >-1 : -1 >1 : number type B2 = 1 | 0 | -1; ->B2 : 1 | 0 | -1 +>B2 : 0 | 1 | -1 >-1 : -1 >1 : number type B3 = 0 | -1 | 1; ->B3 : 0 | -1 | 1 +>B3 : 0 | 1 | -1 >-1 : -1 >1 : number @@ -62,19 +62,19 @@ function f2() { >f2 : () => void var b: B1 = -1; ->b : -1 | 0 | 1 ->B1 : -1 | 0 | 1 +>b : 0 | 1 | -1 +>B1 : 0 | 1 | -1 >-1 : -1 >1 : number var b: B2 = 0; ->b : -1 | 0 | 1 ->B2 : 1 | 0 | -1 +>b : 0 | 1 | -1 +>B2 : 0 | 1 | -1 >0 : 0 var b: B3 = 1; ->b : -1 | 0 | 1 ->B3 : 0 | -1 | 1 +>b : 0 | 1 | -1 +>B3 : 0 | 1 | -1 >1 : 1 } @@ -370,46 +370,46 @@ function f14(x: 0 | 1 | 2, y: string) { >y : string var b = x || y; ->b : 1 | 2 | string ->x || y : 1 | 2 | string +>b : string | 1 | 2 +>x || y : string | 1 | 2 >x : 0 | 1 | 2 >y : string } function f15(x: 0 | false, y: 1 | "one") { ->f15 : (x: 0 | false, y: 1 | "one") => void ->x : 0 | false +>f15 : (x: false | 0, y: 1 | "one") => void +>x : false | 0 >false : false >y : 1 | "one" var a = x && y; ->a : 0 | false ->x && y : 0 | false ->x : 0 | false +>a : false | 0 +>x && y : false | 0 +>x : false | 0 >y : 1 | "one" var b = y && x; ->b : 0 | false ->y && x : 0 | false +>b : false | 0 +>y && x : false | 0 >y : 1 | "one" ->x : 0 | false +>x : false | 0 var c = x || y; >c : 1 | "one" >x || y : 1 | "one" ->x : 0 | false +>x : false | 0 >y : 1 | "one" var d = y || x; ->d : 1 | "one" | 0 | false ->y || x : 1 | "one" | 0 | false +>d : false | 0 | 1 | "one" +>y || x : false | 0 | 1 | "one" >y : 1 | "one" ->x : 0 | false +>x : false | 0 var e = !x; >e : true >!x : true ->x : 0 | false +>x : false | 0 var f = !y; >f : boolean diff --git a/tests/baselines/reference/numericLiteralTypes2.types b/tests/baselines/reference/numericLiteralTypes2.types index 36c5026ba11..d71c55fd5a2 100644 --- a/tests/baselines/reference/numericLiteralTypes2.types +++ b/tests/baselines/reference/numericLiteralTypes2.types @@ -45,17 +45,17 @@ function f1() { } type B1 = -1 | 0 | 1; ->B1 : -1 | 0 | 1 +>B1 : 0 | 1 | -1 >-1 : -1 >1 : number type B2 = 1 | 0 | -1; ->B2 : 1 | 0 | -1 +>B2 : 0 | 1 | -1 >-1 : -1 >1 : number type B3 = 0 | -1 | 1; ->B3 : 0 | -1 | 1 +>B3 : 0 | 1 | -1 >-1 : -1 >1 : number @@ -63,19 +63,19 @@ function f2() { >f2 : () => void var b: B1 = -1; ->b : -1 | 0 | 1 ->B1 : -1 | 0 | 1 +>b : 0 | 1 | -1 +>B1 : 0 | 1 | -1 >-1 : -1 >1 : number var b: B2 = 0; ->b : -1 | 0 | 1 ->B2 : 1 | 0 | -1 +>b : 0 | 1 | -1 +>B2 : 0 | 1 | -1 >0 : 0 var b: B3 = 1; ->b : -1 | 0 | 1 ->B3 : 0 | -1 | 1 +>b : 0 | 1 | -1 +>B3 : 0 | 1 | -1 >1 : 1 } @@ -371,46 +371,46 @@ function f14(x: 0 | 1 | 2, y: string) { >y : string var b = x || y; ->b : 1 | 2 | string ->x || y : 1 | 2 | string +>b : string | 1 | 2 +>x || y : string | 1 | 2 >x : 0 | 1 | 2 >y : string } function f15(x: 0 | false, y: 1 | "one") { ->f15 : (x: 0 | false, y: 1 | "one") => void ->x : 0 | false +>f15 : (x: false | 0, y: 1 | "one") => void +>x : false | 0 >false : false >y : 1 | "one" var a = x && y; ->a : 0 | false ->x && y : 0 | false ->x : 0 | false +>a : false | 0 +>x && y : false | 0 +>x : false | 0 >y : 1 | "one" var b = y && x; ->b : 0 | false ->y && x : 0 | false +>b : false | 0 +>y && x : false | 0 >y : 1 | "one" ->x : 0 | false +>x : false | 0 var c = x || y; >c : 1 | "one" >x || y : 1 | "one" ->x : 0 | false +>x : false | 0 >y : 1 | "one" var d = y || x; >d : 1 | "one" >y || x : 1 | "one" >y : 1 | "one" ->x : 0 | false +>x : false | 0 var e = !x; >e : true >!x : true ->x : 0 | false +>x : false | 0 var f = !y; >f : false diff --git a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt index b96b9b0c542..98f2e30287c 100644 --- a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt +++ b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(9,18): error TS2322: Type '{ forword: string; }' is not assignable to type 'Book'. Object literal may only specify known properties, and 'forword' does not exist in type 'Book'. -tests/cases/compiler/objectLiteralExcessProperties.ts(11,27): error TS2322: Type '{ foreward: string; }' is not assignable to type 'Book | string'. - Object literal may only specify known properties, and 'foreward' does not exist in type 'Book | string'. +tests/cases/compiler/objectLiteralExcessProperties.ts(11,27): error TS2322: Type '{ foreward: string; }' is not assignable to type 'string | Book'. + Object literal may only specify known properties, and 'foreward' does not exist in type 'string | Book'. tests/cases/compiler/objectLiteralExcessProperties.ts(13,53): error TS2322: Type '({ foreword: string; } | { forwards: string; })[]' is not assignable to type 'Book | Book[]'. Type '({ foreword: string; } | { forwards: string; })[]' is not assignable to type 'Book[]'. Type '{ foreword: string; } | { forwards: string; }' is not assignable to type 'Book'. @@ -41,8 +41,8 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type var b2: Book | string = { foreward: "nope" }; ~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '{ foreward: string; }' is not assignable to type 'Book | string'. -!!! error TS2322: Object literal may only specify known properties, and 'foreward' does not exist in type 'Book | string'. +!!! error TS2322: Type '{ foreward: string; }' is not assignable to type 'string | Book'. +!!! error TS2322: Object literal may only specify known properties, and 'foreward' does not exist in type 'string | Book'. var b3: Book | (Book[]) = [{ foreword: "hello" }, { forwards: "back" }]; ~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/promiseType.types b/tests/baselines/reference/promiseType.types index 42f885eff68..1608182d6e9 100644 --- a/tests/baselines/reference/promiseType.types +++ b/tests/baselines/reference/promiseType.types @@ -21,8 +21,8 @@ const b = p.then(b => 1); >1 : number const c = p.then(b => 1, e => 'error'); ->c : Promise ->p.then(b => 1, e => 'error') : Promise +>c : Promise +>p.then(b => 1, e => 'error') : Promise >p.then : { (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike): Promise; (): Promise; } >p : Promise >then : { (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike): Promise; (): Promise; } @@ -78,8 +78,8 @@ const f = p.then(b => 1, e => Promise.reject(Error())); >Error : ErrorConstructor const g = p.catch(e => 'error'); ->g : Promise ->p.catch(e => 'error') : Promise +>g : Promise +>p.catch(e => 'error') : Promise >p.catch : { (onrejected: (reason: any) => TResult | PromiseLike): Promise; (onrejected: (reason: any) => boolean | PromiseLike): Promise; } >p : Promise >catch : { (onrejected: (reason: any) => TResult | PromiseLike): Promise; (onrejected: (reason: any) => boolean | PromiseLike): Promise; } diff --git a/tests/baselines/reference/recursiveUnionTypeInference.types b/tests/baselines/reference/recursiveUnionTypeInference.types index e5d62a051a5..72fb1efad3e 100644 --- a/tests/baselines/reference/recursiveUnionTypeInference.types +++ b/tests/baselines/reference/recursiveUnionTypeInference.types @@ -9,16 +9,16 @@ interface Foo { } function bar(x: Foo | string): T { ->bar : (x: Foo | string) => T +>bar : (x: string | Foo) => T >T : T ->x : Foo | string +>x : string | Foo >Foo : Foo >T : T >T : T return bar(x); >bar(x) : T ->bar : (x: Foo | string) => T ->x : Foo | string +>bar : (x: string | Foo) => T +>x : string | Foo } diff --git a/tests/baselines/reference/resolveInterfaceNameWithSameLetDeclarationName2.types b/tests/baselines/reference/resolveInterfaceNameWithSameLetDeclarationName2.types index 6c52661ef49..1220152d212 100644 --- a/tests/baselines/reference/resolveInterfaceNameWithSameLetDeclarationName2.types +++ b/tests/baselines/reference/resolveInterfaceNameWithSameLetDeclarationName2.types @@ -6,12 +6,12 @@ interface bar { } >bar : bar let bar: bar | foo; ->bar : bar | foo +>bar : foo | bar >bar : bar >foo : foo let foo: bar | foo; ->foo : bar | foo +>foo : foo | bar >bar : bar >foo : foo diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.types index fbe264eeeae..c2a88a68838 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.types @@ -429,7 +429,7 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", " for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >robotA : [number, string, string] >i : number >0 : number @@ -448,7 +448,7 @@ for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { } for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >getRobot() : [number, string, string] >getRobot : () => [number, string, string] >i : number @@ -467,9 +467,9 @@ for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { >numberA3 : number } for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { ->numberA3 : number | string ->robotAInfo : (number | string)[] ->[2, "trimmer", "trimming"] : (number | string)[] +>numberA3 : string | number +>robotAInfo : (string | number)[] +>[2, "trimmer", "trimming"] : (string | number)[] >2 : number >"trimmer" : string >"trimming" : string @@ -486,7 +486,7 @@ for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i >console.log : (msg: any) => void >console : { log(msg: any): void; } >log : (msg: any) => void ->numberA3 : number | string +>numberA3 : string | number } for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { >multiRobotAInfo : (string | [string, string])[] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.types index a50f506262d..e9f7a0a7406 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2.types @@ -69,7 +69,7 @@ let numberA2: number, nameA2: string, skillA2: string, nameMA: string; let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >multiRobotAInfo : (string | [string, string])[] let i: number; @@ -531,10 +531,10 @@ for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edgi for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { >[numberA3, ...robotAInfo] = robotA, i = 0 : number >[numberA3, ...robotAInfo] = robotA : [number, string, string] ->[numberA3, ...robotAInfo] : (number | string)[] +>[numberA3, ...robotAInfo] : (string | number)[] >numberA3 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >robotA : [number, string, string] >i = 0 : number >i : number @@ -555,10 +555,10 @@ for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { >[numberA3, ...robotAInfo] = getRobot(), i = 0 : number >[numberA3, ...robotAInfo] = getRobot() : [number, string, string] ->[numberA3, ...robotAInfo] : (number | string)[] +>[numberA3, ...robotAInfo] : (string | number)[] >numberA3 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >getRobot() : [number, string, string] >getRobot : () => [number, string, string] >i = 0 : number @@ -580,10 +580,10 @@ for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { >[numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0 : number >[numberA3, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] ->[numberA3, ...robotAInfo] : (number | string)[] +>[numberA3, ...robotAInfo] : (string | number)[] >numberA3 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >[2, "trimmer", "trimming"] : [number, string, string] >Robot : [number, string, string] >[2, "trimmer", "trimming"] : [number, string, string] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.types index 245328296eb..700e7b9f863 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.types @@ -534,7 +534,7 @@ for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { >numberA3 : number >-1 : number >1 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >robotA : [number, string, string] >i : number >0 : number @@ -555,7 +555,7 @@ for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { >numberA3 : number >-1 : number >1 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >getRobot() : [number, string, string] >getRobot : () => [number, string, string] >i : number @@ -574,11 +574,11 @@ for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { >numberA3 : number } for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { ->numberA3 : number | string +>numberA3 : string | number >-1 : number >1 : number ->robotAInfo : (number | string)[] ->[2, "trimmer", "trimming"] : (number | string)[] +>robotAInfo : (string | number)[] +>[2, "trimmer", "trimming"] : (string | number)[] >2 : number >"trimmer" : string >"trimming" : string @@ -595,5 +595,5 @@ for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < >console.log : (msg: any) => void >console : { log(msg: any): void; } >log : (msg: any) => void ->numberA3 : number | string +>numberA3 : string | number } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.types index 3bef86dcf80..93d149a6bde 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.types @@ -69,7 +69,7 @@ let numberA2: number, nameA2: string, skillA2: string, nameMA: string; let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >multiRobotAInfo : (string | [string, string])[] let i: number; @@ -666,13 +666,13 @@ for ([nameMA = "noName", for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { >[numberA3 = -1, ...robotAInfo] = robotA, i = 0 : number >[numberA3 = -1, ...robotAInfo] = robotA : [number, string, string] ->[numberA3 = -1, ...robotAInfo] : (number | string)[] +>[numberA3 = -1, ...robotAInfo] : (string | number)[] >numberA3 = -1 : number >numberA3 : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >robotA : [number, string, string] >i = 0 : number >i : number @@ -693,13 +693,13 @@ for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { >[numberA3 = -1, ...robotAInfo] = getRobot(), i = 0 : number >[numberA3 = -1, ...robotAInfo] = getRobot() : [number, string, string] ->[numberA3 = -1, ...robotAInfo] : (number | string)[] +>[numberA3 = -1, ...robotAInfo] : (string | number)[] >numberA3 = -1 : number >numberA3 : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >getRobot() : [number, string, string] >getRobot : () => [number, string, string] >i = 0 : number @@ -721,13 +721,13 @@ for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { >[numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0 : number >[numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] ->[numberA3 = -1, ...robotAInfo] : (number | string)[] +>[numberA3 = -1, ...robotAInfo] : (string | number)[] >numberA3 = -1 : number >numberA3 : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >[2, "trimmer", "trimming"] : [number, string, string] >Robot : [number, string, string] >[2, "trimmer", "trimming"] : [number, string, string] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.types index 95c947f8fcc..aebfe16dcde 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern.types @@ -314,7 +314,7 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB for (let [numberA3, ...robotAInfo] of robots) { >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >robots : [number, string, string][] console.log(numberA3); @@ -326,7 +326,7 @@ for (let [numberA3, ...robotAInfo] of robots) { } for (let [numberA3, ...robotAInfo] of getRobots()) { >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >getRobots() : [number, string, string][] >getRobots : () => [number, string, string][] @@ -339,7 +339,7 @@ for (let [numberA3, ...robotAInfo] of getRobots()) { } for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >[robotA, robotB] : [number, string, string][] >robotA : [number, string, string] >robotB : [number, string, string] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.types index 78cb778b545..be84bbe3459 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2.types @@ -89,7 +89,7 @@ let numberA2: number, nameA2: string, skillA2: string, nameMA: string; let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >multiRobotAInfo : (string | [string, string])[] for ([, nameA] of robots) { @@ -357,10 +357,10 @@ for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { } for ([numberA3, ...robotAInfo] of robots) { ->[numberA3, ...robotAInfo] : (number | string)[] +>[numberA3, ...robotAInfo] : (string | number)[] >numberA3 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >robots : [number, string, string][] console.log(numberA3); @@ -371,10 +371,10 @@ for ([numberA3, ...robotAInfo] of robots) { >numberA3 : number } for ([numberA3, ...robotAInfo] of getRobots()) { ->[numberA3, ...robotAInfo] : (number | string)[] +>[numberA3, ...robotAInfo] : (string | number)[] >numberA3 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >getRobots() : [number, string, string][] >getRobots : () => [number, string, string][] @@ -386,10 +386,10 @@ for ([numberA3, ...robotAInfo] of getRobots()) { >numberA3 : number } for ([numberA3, ...robotAInfo] of [robotA, robotB]) { ->[numberA3, ...robotAInfo] : (number | string)[] +>[numberA3, ...robotAInfo] : (string | number)[] >numberA3 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >[robotA, robotB] : [number, string, string][] >robotA : [number, string, string] >robotB : [number, string, string] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.types index 488b5c46145..80ba5df531f 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.types @@ -409,7 +409,7 @@ for (let [numberA3 = -1, ...robotAInfo] of robots) { >numberA3 : number >-1 : number >1 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >robots : [number, string, string][] console.log(numberA3); @@ -423,7 +423,7 @@ for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { >numberA3 : number >-1 : number >1 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >getRobots() : [number, string, string][] >getRobots : () => [number, string, string][] @@ -438,7 +438,7 @@ for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { >numberA3 : number >-1 : number >1 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >[robotA, robotB] : [number, string, string][] >robotA : [number, string, string] >robotB : [number, string, string] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.types index 5f580ad38f4..257663d7fe3 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.types @@ -89,7 +89,7 @@ let numberA2: number, nameA2: string, skillA2: string, nameMA: string; let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >multiRobotAInfo : (string | [string, string])[] for ([, nameA = "noName"] of robots) { @@ -489,13 +489,13 @@ for ([nameMA = "noName", [ } for ([numberA3 = -1, ...robotAInfo] of robots) { ->[numberA3 = -1, ...robotAInfo] : (number | string)[] +>[numberA3 = -1, ...robotAInfo] : (string | number)[] >numberA3 = -1 : number >numberA3 : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >robots : [number, string, string][] console.log(numberA3); @@ -506,13 +506,13 @@ for ([numberA3 = -1, ...robotAInfo] of robots) { >numberA3 : number } for ([numberA3 = -1, ...robotAInfo] of getRobots()) { ->[numberA3 = -1, ...robotAInfo] : (number | string)[] +>[numberA3 = -1, ...robotAInfo] : (string | number)[] >numberA3 = -1 : number >numberA3 : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >getRobots() : [number, string, string][] >getRobots : () => [number, string, string][] @@ -524,13 +524,13 @@ for ([numberA3 = -1, ...robotAInfo] of getRobots()) { >numberA3 : number } for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { ->[numberA3 = -1, ...robotAInfo] : (number | string)[] +>[numberA3 = -1, ...robotAInfo] : (string | number)[] >numberA3 = -1 : number >numberA3 : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >[robotA, robotB] : [number, string, string][] >robotA : [number, string, string] >robotB : [number, string, string] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.types index 9c695f1c0dd..aab0b3cf5c7 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern.types @@ -62,7 +62,7 @@ function foo3([numberA2, nameA2, skillA2]: Robot) { function foo4([numberA3, ...robotAInfo]: Robot) { >foo4 : ([numberA3, ...robotAInfo]: [number, string, string]) => void >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >Robot : [number, string, string] console.log(robotAInfo); @@ -70,7 +70,7 @@ function foo4([numberA3, ...robotAInfo]: Robot) { >console.log : (msg: any) => void >console : { log(msg: any): void; } >log : (msg: any) => void ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] } foo1(robotA); diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.types index 366c538dda7..43420fdd587 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.types @@ -86,7 +86,7 @@ function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { >numberA3 : number >-1 : number >1 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >Robot : [number, string, string] >[-1, "name", "skill"] : [number, string, string] >-1 : number @@ -99,7 +99,7 @@ function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { >console.log : (msg: any) => void >console : { log(msg: any): void; } >log : (msg: any) => void ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] } foo1(robotA); diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.types index 73006f4ec45..db6e57258d7 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern.types @@ -59,7 +59,7 @@ let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; let [numberA3, ...robotAInfo] = robotA; >numberA3 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >robotA : [number, string, string] if (nameA == nameA2) { diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.types index 5ca93029977..14a8c18c051 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.types @@ -53,7 +53,7 @@ let nameA: string, numberB: number, nameB: string, skillB: string; >skillB : string let robotAInfo: (number | string)[]; ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; >multiSkillB : [string, string] @@ -222,27 +222,27 @@ let multiRobotAInfo: (string | [string, string])[]; [numberB, ...robotAInfo] = robotB; >[numberB, ...robotAInfo] = robotB : [number, string, string] ->[numberB, ...robotAInfo] : (number | string)[] +>[numberB, ...robotAInfo] : (string | number)[] >numberB : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >robotB : [number, string, string] [numberB, ...robotAInfo] = getRobotB(); >[numberB, ...robotAInfo] = getRobotB() : [number, string, string] ->[numberB, ...robotAInfo] : (number | string)[] +>[numberB, ...robotAInfo] : (string | number)[] >numberB : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >getRobotB() : [number, string, string] >getRobotB : () => [number, string, string] [numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; >[numberB, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] ->[numberB, ...robotAInfo] : (number | string)[] +>[numberB, ...robotAInfo] : (string | number)[] >numberB : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >[2, "trimmer", "trimming"] : [number, string, string] >Robot : [number, string, string] >[2, "trimmer", "trimming"] : [number, string, string] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.types index 2dad459725e..be5b47f2eaa 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.types @@ -73,7 +73,7 @@ let [numberA3 = -1, ...robotAInfo] = robotA; >numberA3 : number >-1 : number >1 : number ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] >robotA : [number, string, string] if (nameA == nameA2) { diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types index 7edf6c63e4a..0b1454bdf3b 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.types @@ -53,7 +53,7 @@ let nameA: string, numberB: number, nameB: string, skillB: string; >skillB : string let robotAInfo: (number | string)[]; ->robotAInfo : (number | string)[] +>robotAInfo : (string | number)[] let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; >multiSkillB : string[] @@ -296,36 +296,36 @@ let multiRobotAInfo: (string | string[])[]; [numberB = -1, ...robotAInfo] = robotB; >[numberB = -1, ...robotAInfo] = robotB : [number, string, string] ->[numberB = -1, ...robotAInfo] : (number | string)[] +>[numberB = -1, ...robotAInfo] : (string | number)[] >numberB = -1 : number >numberB : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >robotB : [number, string, string] [numberB = -1, ...robotAInfo] = getRobotB(); >[numberB = -1, ...robotAInfo] = getRobotB() : [number, string, string] ->[numberB = -1, ...robotAInfo] : (number | string)[] +>[numberB = -1, ...robotAInfo] : (string | number)[] >numberB = -1 : number >numberB : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >getRobotB() : [number, string, string] >getRobotB : () => [number, string, string] [numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; >[numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"] : [number, string, string] ->[numberB = -1, ...robotAInfo] : (number | string)[] +>[numberB = -1, ...robotAInfo] : (string | number)[] >numberB = -1 : number >numberB : number >-1 : number >1 : number ->...robotAInfo : number | string ->robotAInfo : (number | string)[] +>...robotAInfo : string | number +>robotAInfo : (string | number)[] >[2, "trimmer", "trimming"] : [number, string, string] >Robot : [number, string, string] >[2, "trimmer", "trimming"] : [number, string, string] diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types index 7140935cb91..e13ac6a64e8 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types @@ -662,9 +662,9 @@ class ListWrapper { >l : T[] >T : T >JSON.stringify(l) : string ->JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (number | string)[], space?: string | number): string; } +>JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } >JSON : JSON ->stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (number | string)[], space?: string | number): string; } +>stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; } >l : T[] static maximum(dit: typeof ListWrapper, list: T[], predicate: (t: T) => number): T { diff --git a/tests/baselines/reference/strictNullLogicalAndOr.types b/tests/baselines/reference/strictNullLogicalAndOr.types index ac02ec1378b..ba25c57fe1d 100644 --- a/tests/baselines/reference/strictNullLogicalAndOr.types +++ b/tests/baselines/reference/strictNullLogicalAndOr.types @@ -14,7 +14,7 @@ let sinOrCos = Math.random() < .5; let choice = sinOrCos && Math.sin || Math.cos; >choice : (x: number) => number >sinOrCos && Math.sin || Math.cos : (x: number) => number ->sinOrCos && Math.sin : ((x: number) => number) | false +>sinOrCos && Math.sin : false | ((x: number) => number) >sinOrCos : boolean >Math.sin : (x: number) => number >Math : Math diff --git a/tests/baselines/reference/stringLiteralCheckedInIf01.types b/tests/baselines/reference/stringLiteralCheckedInIf01.types index 23db9900231..12da51f2b24 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf01.types +++ b/tests/baselines/reference/stringLiteralCheckedInIf01.types @@ -4,18 +4,18 @@ type S = "a" | "b"; >S : "a" | "b" type T = S[] | S; ->T : ("a" | "b")[] | "a" | "b" +>T : "a" | "b" | ("a" | "b")[] >S : "a" | "b" >S : "a" | "b" function f(foo: T) { ->f : (foo: ("a" | "b")[] | "a" | "b") => "a" | "b" ->foo : ("a" | "b")[] | "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>f : (foo: "a" | "b" | ("a" | "b")[]) => "a" | "b" +>foo : "a" | "b" | ("a" | "b")[] +>T : "a" | "b" | ("a" | "b")[] if (foo === "a") { >foo === "a" : boolean ->foo : ("a" | "b")[] | "a" | "b" +>foo : "a" | "b" | ("a" | "b")[] >"a" : "a" return foo; @@ -23,7 +23,7 @@ function f(foo: T) { } else if (foo === "b") { >foo === "b" : boolean ->foo : ("a" | "b")[] | "b" +>foo : "b" | ("a" | "b")[] >"b" : "b" return foo; diff --git a/tests/baselines/reference/stringLiteralCheckedInIf02.types b/tests/baselines/reference/stringLiteralCheckedInIf02.types index b287400b21d..a75cbaab248 100644 --- a/tests/baselines/reference/stringLiteralCheckedInIf02.types +++ b/tests/baselines/reference/stringLiteralCheckedInIf02.types @@ -4,36 +4,36 @@ type S = "a" | "b"; >S : "a" | "b" type T = S[] | S; ->T : ("a" | "b")[] | "a" | "b" +>T : "a" | "b" | ("a" | "b")[] >S : "a" | "b" >S : "a" | "b" function isS(t: T): t is S { ->isS : (t: ("a" | "b")[] | "a" | "b") => t is "a" | "b" ->t : ("a" | "b")[] | "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>isS : (t: "a" | "b" | ("a" | "b")[]) => t is "a" | "b" +>t : "a" | "b" | ("a" | "b")[] +>T : "a" | "b" | ("a" | "b")[] >t : any >S : "a" | "b" return t === "a" || t === "b"; >t === "a" || t === "b" : boolean >t === "a" : boolean ->t : ("a" | "b")[] | "a" | "b" +>t : "a" | "b" | ("a" | "b")[] >"a" : "a" >t === "b" : boolean ->t : ("a" | "b")[] | "b" +>t : "b" | ("a" | "b")[] >"b" : "b" } function f(foo: T) { ->f : (foo: ("a" | "b")[] | "a" | "b") => "a" | "b" ->foo : ("a" | "b")[] | "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>f : (foo: "a" | "b" | ("a" | "b")[]) => "a" | "b" +>foo : "a" | "b" | ("a" | "b")[] +>T : "a" | "b" | ("a" | "b")[] if (isS(foo)) { >isS(foo) : boolean ->isS : (t: ("a" | "b")[] | "a" | "b") => t is "a" | "b" ->foo : ("a" | "b")[] | "a" | "b" +>isS : (t: "a" | "b" | ("a" | "b")[]) => t is "a" | "b" +>foo : "a" | "b" | ("a" | "b")[] return foo; >foo : "a" | "b" diff --git a/tests/baselines/reference/stringLiteralMatchedInSwitch01.types b/tests/baselines/reference/stringLiteralMatchedInSwitch01.types index 21b7029eea6..e5a1fd5486e 100644 --- a/tests/baselines/reference/stringLiteralMatchedInSwitch01.types +++ b/tests/baselines/reference/stringLiteralMatchedInSwitch01.types @@ -4,16 +4,16 @@ type S = "a" | "b"; >S : "a" | "b" type T = S[] | S; ->T : ("a" | "b")[] | "a" | "b" +>T : "a" | "b" | ("a" | "b")[] >S : "a" | "b" >S : "a" | "b" var foo: T; ->foo : ("a" | "b")[] | "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>foo : "a" | "b" | ("a" | "b")[] +>T : "a" | "b" | ("a" | "b")[] switch (foo) { ->foo : ("a" | "b")[] | "a" | "b" +>foo : "a" | "b" | ("a" | "b")[] case "a": >"a" : "a" @@ -25,7 +25,7 @@ switch (foo) { default: foo = (foo as S[])[0]; >foo = (foo as S[])[0] : "a" | "b" ->foo : ("a" | "b")[] | "a" | "b" +>foo : "a" | "b" | ("a" | "b")[] >(foo as S[])[0] : "a" | "b" >(foo as S[]) : ("a" | "b")[] >foo as S[] : ("a" | "b")[] diff --git a/tests/baselines/reference/stringLiteralTypeAssertion01.types b/tests/baselines/reference/stringLiteralTypeAssertion01.types index f70313f8347..6ec5bfff237 100644 --- a/tests/baselines/reference/stringLiteralTypeAssertion01.types +++ b/tests/baselines/reference/stringLiteralTypeAssertion01.types @@ -4,7 +4,7 @@ type S = "a" | "b"; >S : "a" | "b" type T = S[] | S; ->T : ("a" | "b")[] | "a" | "b" +>T : "a" | "b" | ("a" | "b")[] >S : "a" | "b" >S : "a" | "b" @@ -13,8 +13,8 @@ var s: S; >S : "a" | "b" var t: T; ->t : ("a" | "b")[] | "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>t : "a" | "b" | ("a" | "b")[] +>T : "a" | "b" | ("a" | "b")[] var str: string; >str : string @@ -26,13 +26,13 @@ s = t; >s : "a" | "b" >t : "a" | "b" >S : "a" | "b" ->t : ("a" | "b")[] | "a" | "b" +>t : "a" | "b" | ("a" | "b")[] s = t as S; >s = t as S : "a" | "b" >s : "a" | "b" >t as S : "a" | "b" ->t : ("a" | "b")[] | "a" | "b" +>t : "a" | "b" | ("a" | "b")[] >S : "a" | "b" s = str; @@ -52,32 +52,32 @@ s = str as S; //////////////// t = s; ->t = s : ("a" | "b")[] | "a" | "b" ->t : ("a" | "b")[] | "a" | "b" ->s : ("a" | "b")[] | "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>t = s : "a" | "b" | ("a" | "b")[] +>t : "a" | "b" | ("a" | "b")[] +>s : "a" | "b" | ("a" | "b")[] +>T : "a" | "b" | ("a" | "b")[] >s : "a" | "b" t = s as T; ->t = s as T : ("a" | "b")[] | "a" | "b" ->t : ("a" | "b")[] | "a" | "b" ->s as T : ("a" | "b")[] | "a" | "b" +>t = s as T : "a" | "b" | ("a" | "b")[] +>t : "a" | "b" | ("a" | "b")[] +>s as T : "a" | "b" | ("a" | "b")[] >s : "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>T : "a" | "b" | ("a" | "b")[] t = str; ->t = str : ("a" | "b")[] | "a" | "b" ->t : ("a" | "b")[] | "a" | "b" ->str : ("a" | "b")[] | "a" | "b" ->T : ("a" | "b")[] | "a" | "b" +>t = str : "a" | "b" | ("a" | "b")[] +>t : "a" | "b" | ("a" | "b")[] +>str : "a" | "b" | ("a" | "b")[] +>T : "a" | "b" | ("a" | "b")[] >str : string t = str as T; ->t = str as T : ("a" | "b")[] | "a" | "b" ->t : ("a" | "b")[] | "a" | "b" ->str as T : ("a" | "b")[] | "a" | "b" +>t = str as T : "a" | "b" | ("a" | "b")[] +>t : "a" | "b" | ("a" | "b")[] +>str as T : "a" | "b" | ("a" | "b")[] >str : string ->T : ("a" | "b")[] | "a" | "b" +>T : "a" | "b" | ("a" | "b")[] //////////////// @@ -97,11 +97,11 @@ str = t; >str = t : string >str : string >t : string ->t : ("a" | "b")[] | "a" | "b" +>t : "a" | "b" | ("a" | "b")[] str = t as string; >str = t as string : string >str : string >t as string : string ->t : ("a" | "b")[] | "a" | "b" +>t : "a" | "b" | ("a" | "b")[] diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types index 2d997c93ccb..96ec536f82f 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes01.types @@ -27,8 +27,8 @@ else if (x !== "bar") { >"bar" : "bar" let b = x || y; ->b : "baz" | "foo" | "bar" ->x || y : "baz" | "foo" | "bar" +>b : "foo" | "bar" | "baz" +>x || y : "foo" | "bar" | "baz" >x : "baz" >y : "foo" | "bar" | "baz" } @@ -42,10 +42,10 @@ else { >y : "foo" | "bar" | "baz" let e: (typeof x) | (typeof y) = c || d; ->e : "bar" | "foo" | "baz" +>e : "foo" | "bar" | "baz" >x : "bar" >y : "foo" | "bar" | "baz" ->c || d : "bar" | "foo" | "baz" +>c || d : "foo" | "bar" | "baz" >c : "bar" >d : "foo" | "bar" | "baz" } diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types index 2b8bbbcca9c..ab63a9e2fab 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes02.types @@ -4,7 +4,7 @@ type T = string | "foo" | "bar" | "baz"; >T : string | "foo" | "bar" | "baz" var x: "foo" | "bar" | "baz" | string = undefined; ->x : "foo" | "bar" | "baz" | string +>x : string | "foo" | "bar" | "baz" >undefined : undefined var y: T = undefined; @@ -14,49 +14,49 @@ var y: T = undefined; if (x === "foo") { >x === "foo" : boolean ->x : "foo" | "bar" | "baz" | string +>x : string | "foo" | "bar" | "baz" >"foo" : "foo" let a = x; ->a : "foo" | string ->x : "foo" | string +>a : string | "foo" +>x : string | "foo" } else if (x !== "bar") { >x !== "bar" : boolean ->x : "bar" | "baz" | string +>x : string | "bar" | "baz" >"bar" : "bar" let b = x || y; >b : string >x || y : string ->x : "baz" | string +>x : string | "baz" >y : string | "foo" | "bar" | "baz" } else { let c = x; ->c : "bar" | string ->x : "bar" | string +>c : string | "bar" +>x : string | "bar" let d = y; >d : string | "foo" | "bar" | "baz" >y : string | "foo" | "bar" | "baz" let e: (typeof x) | (typeof y) = c || d; ->e : "bar" | string | "foo" | "baz" ->x : "bar" | string +>e : string | "foo" | "bar" | "baz" +>x : string | "bar" >y : string | "foo" | "bar" | "baz" >c || d : string ->c : "bar" | string +>c : string | "bar" >d : string | "foo" | "bar" | "baz" } x = y; >x = y : string | "foo" | "bar" | "baz" ->x : "foo" | "bar" | "baz" | string +>x : string | "foo" | "bar" | "baz" >y : string | "foo" | "bar" | "baz" y = x; ->y = x : "foo" | "bar" | "baz" | string +>y = x : string | "foo" | "bar" | "baz" >y : string | "foo" | "bar" | "baz" ->x : "foo" | "bar" | "baz" | string +>x : string | "foo" | "bar" | "baz" diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types index 73560ac1774..99a729c7cf9 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes03.types @@ -4,7 +4,7 @@ type T = number | "foo" | "bar"; >T : number | "foo" | "bar" var x: "foo" | "bar" | number; ->x : "foo" | "bar" | number +>x : number | "foo" | "bar" var y: T = undefined; >y : number | "foo" | "bar" @@ -13,7 +13,7 @@ var y: T = undefined; if (x === "foo") { >x === "foo" : boolean ->x : "foo" | "bar" | number +>x : number | "foo" | "bar" >"foo" : "foo" let a = x; @@ -22,7 +22,7 @@ if (x === "foo") { } else if (x !== "bar") { >x !== "bar" : boolean ->x : "bar" | number +>x : number | "bar" >"bar" : "bar" let b = x || y; @@ -41,21 +41,21 @@ else { >y : number | "foo" | "bar" let e: (typeof x) | (typeof y) = c || d; ->e : "bar" | number | "foo" +>e : number | "foo" | "bar" >x : "bar" >y : number | "foo" | "bar" ->c || d : "bar" | number | "foo" +>c || d : number | "foo" | "bar" >c : "bar" >d : number | "foo" | "bar" } x = y; >x = y : number | "foo" | "bar" ->x : "foo" | "bar" | number +>x : number | "foo" | "bar" >y : number | "foo" | "bar" y = x; ->y = x : "foo" | "bar" | number +>y = x : number | "foo" | "bar" >y : number | "foo" | "bar" ->x : "foo" | "bar" | number +>x : number | "foo" | "bar" diff --git a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types index bf1cc61175f..963ba4239db 100644 --- a/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types +++ b/tests/baselines/reference/stringLiteralTypesInUnionTypes04.types @@ -35,7 +35,7 @@ if (x !== "") { if (x == "") { >x == "" : boolean ->x : "foo" | "" +>x : "" | "foo" >"" : "" let c = x; @@ -54,7 +54,7 @@ if (x != "") { } if (x) { ->x : "foo" | "" +>x : "" | "foo" let e = x; >e : "foo" @@ -63,17 +63,17 @@ if (x) { if (!x) { >!x : boolean ->x : "foo" | "" +>x : "" | "foo" let f = x; ->f : "foo" | "" ->x : "foo" | "" +>f : "" | "foo" +>x : "" | "foo" } if (!!x) { >!!x : boolean >!x : boolean ->x : "foo" | "" +>x : "" | "foo" let g = x; >g : "foo" @@ -84,9 +84,9 @@ if (!!!x) { >!!!x : boolean >!!x : boolean >!x : boolean ->x : "foo" | "" +>x : "" | "foo" let h = x; ->h : "foo" | "" ->x : "foo" | "" +>h : "" | "foo" +>x : "" | "foo" } diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.js b/tests/baselines/reference/stringLiteralTypesOverloads01.js index f3331c9f717..ef441a40985 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads01.js +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.js @@ -109,6 +109,6 @@ declare const boolean: "boolean"; declare const stringOrNumber: "string" | "number"; declare const stringOrBoolean: "string" | "boolean"; declare const booleanOrNumber: "number" | "boolean"; -declare const stringOrBooleanOrNumber: "string" | "boolean" | "number"; +declare const stringOrBooleanOrNumber: "string" | "number" | "boolean"; declare namespace Consts2 { } diff --git a/tests/baselines/reference/stringLiteralTypesOverloads01.types b/tests/baselines/reference/stringLiteralTypesOverloads01.types index 71a73222ba6..dff55fc08fb 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads01.types +++ b/tests/baselines/reference/stringLiteralTypesOverloads01.types @@ -4,35 +4,35 @@ type PrimitiveName = 'string' | 'number' | 'boolean'; >PrimitiveName : "string" | "number" | "boolean" function getFalsyPrimitive(x: "string"): string; ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >x : "string" function getFalsyPrimitive(x: "number"): number; ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >x : "number" function getFalsyPrimitive(x: "boolean"): boolean; ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >x : "boolean" function getFalsyPrimitive(x: "boolean" | "string"): boolean | string; ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } ->x : "boolean" | "string" +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } +>x : "string" | "boolean" function getFalsyPrimitive(x: "boolean" | "number"): boolean | number; ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } ->x : "boolean" | "number" +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } +>x : "number" | "boolean" function getFalsyPrimitive(x: "number" | "string"): number | string; ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } ->x : "number" | "string" +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } +>x : "string" | "number" function getFalsyPrimitive(x: "number" | "string" | "boolean"): number | string | boolean; ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } ->x : "number" | "string" | "boolean" +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } +>x : "string" | "number" | "boolean" function getFalsyPrimitive(x: PrimitiveName): number | string | boolean { ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >x : "string" | "number" | "boolean" >PrimitiveName : "string" | "number" | "boolean" @@ -72,19 +72,19 @@ namespace Consts1 { const EMPTY_STRING = getFalsyPrimitive("string"); >EMPTY_STRING : string >getFalsyPrimitive("string") : string ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >"string" : "string" const ZERO = getFalsyPrimitive('number'); >ZERO : number >getFalsyPrimitive('number') : number ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >'number' : "number" const FALSE = getFalsyPrimitive("boolean"); >FALSE : boolean >getFalsyPrimitive("boolean") : boolean ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >"boolean" : "boolean" } @@ -119,8 +119,8 @@ const booleanOrNumber = number || boolean; >boolean : "boolean" const stringOrBooleanOrNumber = stringOrBoolean || number; ->stringOrBooleanOrNumber : "string" | "boolean" | "number" ->stringOrBoolean || number : "string" | "boolean" | "number" +>stringOrBooleanOrNumber : "string" | "number" | "boolean" +>stringOrBoolean || number : "string" | "number" | "boolean" >stringOrBoolean : "string" | "boolean" >number : "number" @@ -130,44 +130,44 @@ namespace Consts2 { const EMPTY_STRING = getFalsyPrimitive(string); >EMPTY_STRING : string >getFalsyPrimitive(string) : string ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >string : "string" const ZERO = getFalsyPrimitive(number); >ZERO : number >getFalsyPrimitive(number) : number ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >number : "number" const FALSE = getFalsyPrimitive(boolean); >FALSE : boolean >getFalsyPrimitive(boolean) : boolean ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >boolean : "boolean" const a = getFalsyPrimitive(stringOrNumber); ->a : number | string ->getFalsyPrimitive(stringOrNumber) : number | string ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>a : string | number +>getFalsyPrimitive(stringOrNumber) : string | number +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >stringOrNumber : "string" | "number" const b = getFalsyPrimitive(stringOrBoolean); ->b : boolean | string ->getFalsyPrimitive(stringOrBoolean) : boolean | string ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>b : string | boolean +>getFalsyPrimitive(stringOrBoolean) : string | boolean +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >stringOrBoolean : "string" | "boolean" const c = getFalsyPrimitive(booleanOrNumber); ->c : boolean | number ->getFalsyPrimitive(booleanOrNumber) : boolean | number ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } +>c : number | boolean +>getFalsyPrimitive(booleanOrNumber) : number | boolean +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } >booleanOrNumber : "number" | "boolean" const d = getFalsyPrimitive(stringOrBooleanOrNumber); ->d : number | string | boolean ->getFalsyPrimitive(stringOrBooleanOrNumber) : number | string | boolean ->getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "boolean" | "string"): boolean | string; (x: "boolean" | "number"): boolean | number; (x: "number" | "string"): number | string; (x: "number" | "string" | "boolean"): number | string | boolean; } ->stringOrBooleanOrNumber : "string" | "boolean" | "number" +>d : string | number | boolean +>getFalsyPrimitive(stringOrBooleanOrNumber) : string | number | boolean +>getFalsyPrimitive : { (x: "string"): string; (x: "number"): number; (x: "boolean"): boolean; (x: "string" | "boolean"): string | boolean; (x: "number" | "boolean"): number | boolean; (x: "string" | "number"): string | number; (x: "string" | "number" | "boolean"): string | number | boolean; } +>stringOrBooleanOrNumber : "string" | "number" | "boolean" } diff --git a/tests/baselines/reference/stringLiteralTypesOverloads02.js b/tests/baselines/reference/stringLiteralTypesOverloads02.js index 3c53f9380a8..45443ea6a8f 100644 --- a/tests/baselines/reference/stringLiteralTypesOverloads02.js +++ b/tests/baselines/reference/stringLiteralTypesOverloads02.js @@ -106,6 +106,6 @@ declare const boolean: "boolean"; declare const stringOrNumber: "string" | "number"; declare const stringOrBoolean: "string" | "boolean"; declare const booleanOrNumber: "number" | "boolean"; -declare const stringOrBooleanOrNumber: "string" | "boolean" | "number"; +declare const stringOrBooleanOrNumber: "string" | "number" | "boolean"; declare namespace Consts2 { } diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types index 90cb538b800..d55d5ab9294 100644 --- a/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators01.types @@ -15,8 +15,8 @@ let abcOrXyz: "ABC" | "XYZ" = abc || xyz; >xyz : "XYZ" let abcOrXyzOrNumber: "ABC" | "XYZ" | number = abcOrXyz || 100; ->abcOrXyzOrNumber : "ABC" | "XYZ" | number ->abcOrXyz || 100 : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" +>abcOrXyz || 100 : number | "ABC" | "XYZ" >abcOrXyz : "ABC" | "XYZ" >100 : number @@ -95,47 +95,47 @@ let l = -abcOrXyz; let m = abcOrXyzOrNumber + ""; >m : string >abcOrXyzOrNumber + "" : string ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" >"" : string let n = "" + abcOrXyzOrNumber; >n : string >"" + abcOrXyzOrNumber : string >"" : string ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" let o = abcOrXyzOrNumber + abcOrXyz; >o : string >abcOrXyzOrNumber + abcOrXyz : string ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" >abcOrXyz : "ABC" | "XYZ" let p = abcOrXyz + abcOrXyzOrNumber; >p : string >abcOrXyz + abcOrXyzOrNumber : string >abcOrXyz : "ABC" | "XYZ" ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" let q = !abcOrXyzOrNumber; >q : boolean >!abcOrXyzOrNumber : boolean ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" let r = ~abcOrXyzOrNumber; >r : number >~abcOrXyzOrNumber : number ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" let s = abcOrXyzOrNumber < abcOrXyzOrNumber; >s : boolean >abcOrXyzOrNumber < abcOrXyzOrNumber : boolean ->abcOrXyzOrNumber : "ABC" | "XYZ" | number ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" +>abcOrXyzOrNumber : number | "ABC" | "XYZ" let t = abcOrXyzOrNumber >= abcOrXyz; >t : boolean >abcOrXyzOrNumber >= abcOrXyz : boolean ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" >abcOrXyz : "ABC" | "XYZ" let u = abc === abcOrXyz; @@ -148,5 +148,5 @@ let v = abcOrXyz === abcOrXyzOrNumber; >v : boolean >abcOrXyz === abcOrXyzOrNumber : boolean >abcOrXyz : "ABC" | "XYZ" ->abcOrXyzOrNumber : "ABC" | "XYZ" | number +>abcOrXyzOrNumber : number | "ABC" | "XYZ" diff --git a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt index 92afe67df0c..ad02604cc4c 100644 --- a/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesWithVariousOperators02.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'number'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'number' and '"ABC" | "XYZ" | number'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and '"ABC" | "XYZ" | number'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'boolean'. -tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(11,9): error TS2365: Operator '+' cannot be applied to types 'boolean' and '"ABC" | "XYZ" | number'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(7,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(8,9): error TS2365: Operator '+' cannot be applied to types 'number' and 'number | "ABC" | "XYZ"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(9,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number | "ABC" | "XYZ"'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(10,9): error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'boolean'. +tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(11,9): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number | "ABC" | "XYZ"'. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(12,9): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(13,11): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperators02.ts(14,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -21,19 +21,19 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithVariousOperato let a = abcOrXyzOrNumber + 100; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'number'. +!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number'. let b = 100 + abcOrXyzOrNumber; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'number' and '"ABC" | "XYZ" | number'. +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'number | "ABC" | "XYZ"'. let c = abcOrXyzOrNumber + abcOrXyzOrNumber; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and '"ABC" | "XYZ" | number'. +!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'number | "ABC" | "XYZ"'. let d = abcOrXyzOrNumber + true; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types '"ABC" | "XYZ" | number' and 'boolean'. +!!! error TS2365: Operator '+' cannot be applied to types 'number | "ABC" | "XYZ"' and 'boolean'. let e = false + abcOrXyzOrNumber; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and '"ABC" | "XYZ" | number'. +!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number | "ABC" | "XYZ"'. let f = abcOrXyzOrNumber++; ~~~~~~~~~~~~~~~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types index 39c50bde355..4059a1b0b51 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.types @@ -244,7 +244,7 @@ function f5(x: T) { var r1 = true ? x : 1; // ok >r1 : number | T ->true ? x : 1 : T | number +>true ? x : 1 : number | T >true : boolean >x : T >1 : number @@ -266,7 +266,7 @@ function f6(x: T) { var r2 = true ? x : ''; // ok >r2 : string | T ->true ? x : '' : T | string +>true ? x : '' : string | T >true : boolean >x : T >'' : string @@ -288,7 +288,7 @@ function f7(x: T) { var r3 = true ? x : true; // ok >r3 : boolean | T ->true ? x : true : T | boolean +>true ? x : true : boolean | T >true : boolean >x : T >true : boolean @@ -506,14 +506,14 @@ function f16(x: T) { >T : T var r13 = true ? E : x; // ok ->r13 : typeof E | T ->true ? E : x : typeof E | T +>r13 : T | typeof E +>true ? E : x : T | typeof E >true : boolean >E : typeof E >x : T var r13 = true ? x : E; // ok ->r13 : typeof E | T +>r13 : T | typeof E >true ? x : E : T | typeof E >true : boolean >x : T diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints3.types b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints3.types index 88c58998264..f0f075a37ce 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints3.types +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints3.types @@ -39,21 +39,21 @@ function f(t: T, u: U, v: V) { var r2 = true ? v : t; >r2 : T | V ->true ? v : t : V | T +>true ? v : t : T | V >true : boolean >v : V >t : T // ok var r3 = true ? v : u; ->r3 : V | U ->true ? v : u : V | U +>r3 : U | V +>true ? v : u : U | V >true : boolean >v : V >u : U var r3 = true ? u : v; ->r3 : V | U +>r3 : U | V >true ? u : v : U | V >true : boolean >u : U diff --git a/tests/baselines/reference/subtypesOfUnion.errors.txt b/tests/baselines/reference/subtypesOfUnion.errors.txt index 7c2e88ec8fd..fade5377814 100644 --- a/tests/baselines/reference/subtypesOfUnion.errors.txt +++ b/tests/baselines/reference/subtypesOfUnion.errors.txt @@ -12,21 +12,21 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(28,5): error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'string | number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(29,5): error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'string | number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(30,5): error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'string | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(35,5): error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(37,5): error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(39,5): error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(40,5): error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(41,5): error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(42,5): error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(43,5): error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(44,5): error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(45,5): error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(46,5): error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(47,5): error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(48,5): error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(49,5): error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(50,5): error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'E | number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(51,5): error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'E | number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(35,5): error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(37,5): error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(39,5): error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(40,5): error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(41,5): error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(42,5): error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(43,5): error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(44,5): error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(45,5): error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(46,5): error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(47,5): error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(48,5): error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(49,5): error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(50,5): error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'number | E'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts(51,5): error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'number | E'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts (29 errors) ==== @@ -94,49 +94,49 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf foo: any; // ok foo2: string; // error ~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'number | E'. foo3: number; // ok foo4: boolean; // error ~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'number | E'. foo5: E; // ok foo6: Date; // error ~~~~~~~~~~~ -!!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'number | E'. foo7: RegExp; // error ~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'number | E'. foo8: { bar: number }; // error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'number | E'. foo9: I8; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'number | E'. foo10: A; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'number | E'. foo11: A2; // error ~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'number | E'. foo12: (x) => number; //error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'number | E'. foo13: (x: T) => T; // error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'number | E'. foo14: typeof f; // error ~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'number | E'. foo15: typeof c; // error ~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'number | E'. foo16: T; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'number | E'. foo17: Object; // error ~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'number | E'. foo18: {}; // error ~~~~~~~~~~ -!!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'E | number'. +!!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'number | E'. } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.types b/tests/baselines/reference/subtypingWithCallSignatures2.types index b72993e7bea..8a56e05a9c2 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.types +++ b/tests/baselines/reference/subtypingWithCallSignatures2.types @@ -371,8 +371,8 @@ var r2a = [r2arg1, r2arg2]; >r2arg2 : (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : ((x: number) => string[])[] ->[r2arg2, r2arg1] : ((x: number) => string[])[] +>r2b : ((x: T) => string[])[] +>[r2arg2, r2arg1] : ((x: T) => string[])[] >r2arg2 : (x: number) => string[] >r2arg1 : (x: T) => string[] @@ -402,8 +402,8 @@ var r3a = [r3arg1, r3arg2]; >r3arg2 : (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : ((x: number) => void)[] ->[r3arg2, r3arg1] : ((x: number) => void)[] +>r3b : ((x: T) => T)[] +>[r3arg2, r3arg1] : ((x: T) => T)[] >r3arg2 : (x: number) => void >r3arg1 : (x: T) => T @@ -814,8 +814,8 @@ var r12a = [r12arg1, r12arg2]; >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : ((x: Base[], y: Derived2[]) => Derived[])[] ->[r12arg2, r12arg1] : ((x: Base[], y: Derived2[]) => Derived[])[] +>r12b : ((x: Base[], y: T) => Derived[])[] +>[r12arg2, r12arg1] : ((x: Base[], y: T) => Derived[])[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : (x: Base[], y: T) => Derived[] diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.types b/tests/baselines/reference/subtypingWithCallSignatures3.types index 2d4c6e9fda5..379810b2541 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -349,8 +349,8 @@ module Errors { >r3arg : (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U var r3a = [r3arg2, r3arg]; ->r3a : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U))[] ->[r3arg2, r3arg] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U))[] +>r3a : (((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>[r3arg2, r3arg] : (((x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] >r3arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r3arg : (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U @@ -553,8 +553,8 @@ module Errors { >r7arg3 : (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : ((x: { a: T; b: T; }) => number)[] ->[r7arg3, r7arg2] : ((x: { a: T; b: T; }) => number)[] +>r7e : ((x: { a: string; b: number; }) => number)[] +>[r7arg3, r7arg2] : ((x: { a: string; b: number; }) => number)[] >r7arg3 : (x: { a: T; b: T; }) => number >r7arg2 : (x: { a: string; b: number; }) => number diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.types b/tests/baselines/reference/subtypingWithCallSignatures4.types index f490f787878..e76d36114e9 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.types +++ b/tests/baselines/reference/subtypingWithCallSignatures4.types @@ -323,8 +323,8 @@ var r3a = [r3arg, r3arg2]; >r3arg2 : (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : ((x: T) => void)[] ->[r3arg2, r3arg] : ((x: T) => void)[] +>r3b : ((x: T) => T)[] +>[r3arg2, r3arg] : ((x: T) => T)[] >r3arg2 : (x: T) => void >r3arg : (x: T) => T @@ -453,8 +453,8 @@ var r6a = [r6arg, r6arg2]; >r6arg2 : (x: (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : ((x: (arg: T) => Derived) => T)[] ->[r6arg2, r6arg] : ((x: (arg: T) => Derived) => T)[] +>r6b : ((x: (arg: T) => U) => T)[] +>[r6arg2, r6arg] : ((x: (arg: T) => U) => T)[] >r6arg2 : (x: (arg: T) => Derived) => T >r6arg : (x: (arg: T) => U) => T @@ -504,8 +504,8 @@ var r11a = [r11arg, r11arg2]; >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base var r11b = [r11arg2, r11arg]; ->r11b : ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] ->[r11arg2, r11arg] : ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] +>r11b : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>[r11arg2, r11arg] : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -549,8 +549,8 @@ var r15a = [r15arg, r15arg2]; >r15arg2 : (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : ((x: { a: T; b: T; }) => T[])[] ->[r15arg2, r15arg] : ((x: { a: T; b: T; }) => T[])[] +>r15b : ((x: { a: U; b: V; }) => U[])[] +>[r15arg2, r15arg] : ((x: { a: U; b: V; }) => U[])[] >r15arg2 : (x: { a: T; b: T; }) => T[] >r15arg : (x: { a: U; b: V; }) => U[] diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.types b/tests/baselines/reference/subtypingWithConstructSignatures2.types index c66d6055558..d723a367ecb 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.types @@ -360,8 +360,8 @@ var r2a = [r2arg1, r2arg2]; >r2arg2 : new (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : (new (x: number) => string[])[] ->[r2arg2, r2arg1] : (new (x: number) => string[])[] +>r2b : (new (x: T) => string[])[] +>[r2arg2, r2arg1] : (new (x: T) => string[])[] >r2arg2 : new (x: number) => string[] >r2arg1 : new (x: T) => string[] @@ -389,8 +389,8 @@ var r3a = [r3arg1, r3arg2]; >r3arg2 : new (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : (new (x: number) => void)[] ->[r3arg2, r3arg1] : (new (x: number) => void)[] +>r3b : (new (x: T) => T)[] +>[r3arg2, r3arg1] : (new (x: T) => T)[] >r3arg2 : new (x: number) => void >r3arg1 : new (x: T) => T @@ -636,8 +636,8 @@ var r9a = [r9arg1, r9arg2]; >r9arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived var r9b = [r9arg2, r9arg1]; ->r9b : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U))[] ->[r9arg2, r9arg1] : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U))[] +>r9b : ((new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] +>[r9arg2, r9arg1] : ((new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] >r9arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived >r9arg1 : new (x: new (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => new (r: T) => U @@ -747,8 +747,8 @@ var r12a = [r12arg1, r12arg2]; >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : (new (x: Base[], y: Derived2[]) => Derived[])[] ->[r12arg2, r12arg1] : (new (x: Base[], y: Derived2[]) => Derived[])[] +>r12b : (new (x: Base[], y: T) => Derived[])[] +>[r12arg2, r12arg1] : (new (x: Base[], y: T) => Derived[])[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : new (x: Base[], y: T) => Derived[] diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.types b/tests/baselines/reference/subtypingWithConstructSignatures3.types index 741db4f4ba6..b0f0680c7a0 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.types @@ -318,8 +318,8 @@ module Errors { >r3arg1 : new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U var r3a = [r3arg2, r3arg1]; ->r3a : ((new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U))[] ->[r3arg2, r3arg1] : ((new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U))[] +>r3a : ((new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U) | (new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] +>[r3arg2, r3arg1] : ((new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U) | (new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] >r3arg2 : new (x: (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived >r3arg1 : new (x: new (arg: T) => U, y: (arg2: { foo: number; }) => U) => new (r: T) => U @@ -497,8 +497,8 @@ module Errors { >r7arg3 : new (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : (new (x: { a: T; b: T; }) => number)[] ->[r7arg3, r7arg2] : (new (x: { a: T; b: T; }) => number)[] +>r7e : (new (x: { a: string; b: number; }) => number)[] +>[r7arg3, r7arg2] : (new (x: { a: string; b: number; }) => number)[] >r7arg3 : new (x: { a: T; b: T; }) => number >r7arg2 : new (x: { a: string; b: number; }) => number diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.types b/tests/baselines/reference/subtypingWithConstructSignatures4.types index 932adcb7368..21a40ecf7fc 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.types @@ -307,8 +307,8 @@ var r3a = [r3arg, r3arg2]; >r3arg2 : new (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : (new (x: T) => void)[] ->[r3arg2, r3arg] : (new (x: T) => void)[] +>r3b : (new (x: T) => T)[] +>[r3arg2, r3arg] : (new (x: T) => T)[] >r3arg2 : new (x: T) => void >r3arg : new (x: T) => T @@ -421,8 +421,8 @@ var r6a = [r6arg, r6arg2]; >r6arg2 : new (x: new (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : (new (x: new (arg: T) => Derived) => T)[] ->[r6arg2, r6arg] : (new (x: new (arg: T) => Derived) => T)[] +>r6b : (new (x: new (arg: T) => U) => T)[] +>[r6arg2, r6arg] : (new (x: new (arg: T) => U) => T)[] >r6arg2 : new (x: new (arg: T) => Derived) => T >r6arg : new (x: new (arg: T) => U) => T @@ -466,8 +466,8 @@ var r11a = [r11arg, r11arg2]; >r11arg2 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base var r11b = [r11arg2, r11arg]; ->r11b : (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] ->[r11arg2, r11arg] : (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base)[] +>r11b : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>[r11arg2, r11arg] : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] >r11arg2 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -505,8 +505,8 @@ var r15a = [r15arg, r15arg2]; >r15arg2 : new (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : (new (x: { a: T; b: T; }) => T[])[] ->[r15arg2, r15arg] : (new (x: { a: T; b: T; }) => T[])[] +>r15b : (new (x: { a: U; b: V; }) => U[])[] +>[r15arg2, r15arg] : (new (x: { a: U; b: V; }) => U[])[] >r15arg2 : new (x: { a: T; b: T; }) => T[] >r15arg : new (x: { a: U; b: V; }) => U[] diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types index b251db43301..903c4ec0ecc 100644 --- a/tests/baselines/reference/symbolType11.types +++ b/tests/baselines/reference/symbolType11.types @@ -28,7 +28,7 @@ s || s; >s : symbol s || 1; ->s || 1 : symbol | number +>s || 1 : number | symbol >s : symbol >1 : number diff --git a/tests/baselines/reference/targetTypeTest2.types b/tests/baselines/reference/targetTypeTest2.types index 53381b9de43..25b36f948c6 100644 --- a/tests/baselines/reference/targetTypeTest2.types +++ b/tests/baselines/reference/targetTypeTest2.types @@ -4,7 +4,7 @@ var a : any[] = [1,2,"3"]; >a : any[] ->[1,2,"3"] : (number | string)[] +>[1,2,"3"] : (string | number)[] >1 : number >2 : number >"3" : string diff --git a/tests/baselines/reference/targetTypeTest3.errors.txt b/tests/baselines/reference/targetTypeTest3.errors.txt index 935a9b9e68e..f5dab732ed3 100644 --- a/tests/baselines/reference/targetTypeTest3.errors.txt +++ b/tests/baselines/reference/targetTypeTest3.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/targetTypeTest3.ts(4,5): error TS2322: Type '(number | string)[]' is not assignable to type 'string[]'. - Type 'number | string' is not assignable to type 'string'. +tests/cases/compiler/targetTypeTest3.ts(4,5): error TS2322: Type '(string | number)[]' is not assignable to type 'string[]'. + Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. @@ -9,8 +9,8 @@ tests/cases/compiler/targetTypeTest3.ts(4,5): error TS2322: Type '(number | stri var a : string[] = [1,2,"3"]; // should produce an error ~ -!!! error TS2322: Type '(number | string)[]' is not assignable to type 'string[]'. -!!! error TS2322: Type 'number | string' is not assignable to type 'string'. +!!! error TS2322: Type '(string | number)[]' is not assignable to type 'string[]'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/templateStringInArray.types b/tests/baselines/reference/templateStringInArray.types index aec30c02e00..04cc09a1005 100644 --- a/tests/baselines/reference/templateStringInArray.types +++ b/tests/baselines/reference/templateStringInArray.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/templates/templateStringInArray.ts === var x = [1, 2, `abc${ 123 }def`]; ->x : (number | string)[] ->[1, 2, `abc${ 123 }def`] : (number | string)[] +>x : (string | number)[] +>[1, 2, `abc${ 123 }def`] : (string | number)[] >1 : number >2 : number >`abc${ 123 }def` : string diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditional.types b/tests/baselines/reference/templateStringWithEmbeddedConditional.types index 2a741dc271b..7ec1ef97a30 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedConditional.types +++ b/tests/baselines/reference/templateStringWithEmbeddedConditional.types @@ -2,7 +2,7 @@ var x = `abc${ true ? false : " " }def`; >x : string >`abc${ true ? false : " " }def` : string ->true ? false : " " : boolean | string +>true ? false : " " : string | boolean >true : boolean >false : boolean >" " : string diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types b/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types index d0a228ee673..5453880ce16 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types +++ b/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types @@ -2,7 +2,7 @@ var x = `abc${ true ? false : " " }def`; >x : string >`abc${ true ? false : " " }def` : string ->true ? false : " " : boolean | string +>true ? false : " " : string | boolean >true : boolean >false : boolean >" " : string diff --git a/tests/baselines/reference/thisTypeInTuples.types b/tests/baselines/reference/thisTypeInTuples.types index e0268840317..d2d70ad8e09 100644 --- a/tests/baselines/reference/thisTypeInTuples.types +++ b/tests/baselines/reference/thisTypeInTuples.types @@ -16,24 +16,24 @@ let t: [number, string] = [42, "hello"]; let a = t.slice(); >a : [number, string] >t.slice() : [number, string] ->t.slice : { (start?: number, end?: number): (number | string)[]; (): [number, string]; } +>t.slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; } >t : [number, string] ->slice : { (start?: number, end?: number): (number | string)[]; (): [number, string]; } +>slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; } let b = t.slice(1); ->b : (number | string)[] ->t.slice(1) : (number | string)[] ->t.slice : { (start?: number, end?: number): (number | string)[]; (): [number, string]; } +>b : (string | number)[] +>t.slice(1) : (string | number)[] +>t.slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; } >t : [number, string] ->slice : { (start?: number, end?: number): (number | string)[]; (): [number, string]; } +>slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; } >1 : number let c = t.slice(0, 1); ->c : (number | string)[] ->t.slice(0, 1) : (number | string)[] ->t.slice : { (start?: number, end?: number): (number | string)[]; (): [number, string]; } +>c : (string | number)[] +>t.slice(0, 1) : (string | number)[] +>t.slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; } >t : [number, string] ->slice : { (start?: number, end?: number): (number | string)[]; (): [number, string]; } +>slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; } >0 : number >1 : number diff --git a/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt b/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt index 498e74ce350..b502eaad7e5 100644 --- a/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt +++ b/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(5,19): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. - Type 'number | string' is not assignable to type 'number'. +tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(5,19): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(6,19): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. - Type 'number | string' is not assignable to type 'number'. +tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(6,19): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. @@ -13,13 +13,13 @@ tests/cases/compiler/trailingCommaInHeterogenousArrayLiteral1.ts(6,19): error TS // these two should give the same error this.test([1, 2, "hi", 5, ]); ~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'number | string' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. this.test([1, 2, "hi", 5]); ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'number | string' is not assignable to type 'number'. +!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'. +!!! error TS2345: Type 'string | number' is not assignable to type 'number'. !!! error TS2345: Type 'string' is not assignable to type 'number'. } } diff --git a/tests/baselines/reference/tupleTypes.errors.txt b/tests/baselines/reference/tupleTypes.errors.txt index 8f418f98157..75f413eb170 100644 --- a/tests/baselines/reference/tupleTypes.errors.txt +++ b/tests/baselines/reference/tupleTypes.errors.txt @@ -9,8 +9,8 @@ tests/cases/compiler/tupleTypes.ts(17,1): error TS2322: Type '[string, number]' tests/cases/compiler/tupleTypes.ts(41,1): error TS2322: Type 'undefined[]' is not assignable to type '[number, string]'. tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'. Types of property 'pop' are incompatible. - Type '() => number | string' is not assignable to type '() => number'. - Type 'number | string' is not assignable to type 'number'. + Type '() => string | number' is not assignable to type '() => number'. + Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/tupleTypes.ts(49,1): error TS2322: Type '[number, {}]' is not assignable to type 'number[]'. Types of property 'pop' are incompatible. @@ -90,8 +90,8 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n ~ !!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'. -!!! error TS2322: Type 'number | string' is not assignable to type 'number'. +!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'. +!!! error TS2322: Type 'string | number' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. a = a2; a = a3; // Error diff --git a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types index eb0fcdcbbca..45ddf8cd949 100644 --- a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types +++ b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types @@ -4,7 +4,7 @@ declare module m { // type alias declaration here shouldnt make the module declaration instantiated type Selector = string| string[] |Function; ->Selector : string | string[] | Function +>Selector : string | Function | string[] >Function : Function export interface IStatic { diff --git a/tests/baselines/reference/typeAssertions.errors.txt b/tests/baselines/reference/typeAssertions.errors.txt index e330c23d737..c840e016083 100644 --- a/tests/baselines/reference/typeAssertions.errors.txt +++ b/tests/baselines/reference/typeAssertions.errors.txt @@ -13,7 +13,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,14): err tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,17): error TS1005: ')' expected. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,17): error TS2304: Cannot find name 'string'. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,48): error TS1005: ';' expected. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(45,2): error TS2322: Type 'number | string' is not assignable to type 'string'. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(45,2): error TS2322: Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,32): error TS2304: Cannot find name 'numOrStr'. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,41): error TS1005: ')' expected. @@ -96,7 +96,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err !!! error TS1005: ';' expected. str = numOrStr; // Error, no narrowing occurred ~~~ -!!! error TS2322: Type 'number | string' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. } diff --git a/tests/baselines/reference/typeGuardEnums.types b/tests/baselines/reference/typeGuardEnums.types index f106896c52f..f9d5cb1754e 100644 --- a/tests/baselines/reference/typeGuardEnums.types +++ b/tests/baselines/reference/typeGuardEnums.types @@ -6,14 +6,14 @@ enum V {} >V : V let x: number|string|E|V; ->x : number | string | E | V +>x : string | number | E | V >E : E >V : V if (typeof x === "number") { >typeof x === "number" : boolean >typeof x : string ->x : number | string | E | V +>x : string | number | E | V >"number" : "number" x; // number|E|V @@ -27,7 +27,7 @@ else { if (typeof x !== "number") { >typeof x !== "number" : boolean >typeof x : string ->x : number | E | V | string +>x : string | number | E | V >"number" : "number" x; // string diff --git a/tests/baselines/reference/typeGuardFunction.types b/tests/baselines/reference/typeGuardFunction.types index 7f60bbc0a3b..1e2be413a2b 100644 --- a/tests/baselines/reference/typeGuardFunction.types +++ b/tests/baselines/reference/typeGuardFunction.types @@ -216,7 +216,7 @@ acceptingTypeGuardFunction(isA); // Binary expressions let union2: C | B; ->union2 : C | B +>union2 : B | C >C : C >B : B @@ -226,6 +226,6 @@ let union3: boolean | B = isA(union2) || union2; >isA(union2) || union2 : true | B >isA(union2) : boolean >isA : (p1: any) => p1 is A ->union2 : C | B +>union2 : B | C >union2 : B diff --git a/tests/baselines/reference/typeGuardNesting.types b/tests/baselines/reference/typeGuardNesting.types index 0532e4d2536..6c2df126df1 100644 --- a/tests/baselines/reference/typeGuardNesting.types +++ b/tests/baselines/reference/typeGuardNesting.types @@ -23,7 +23,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri >(typeof strOrBool === 'string') : boolean >typeof strOrBool === 'string' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'string' : "string" >strOrBool : string >"string" : string @@ -45,7 +45,7 @@ if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'stri >(typeof strOrBool !== 'boolean') : boolean >typeof strOrBool !== 'boolean' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'boolean' : "boolean" >strOrBool : string >"string" : string @@ -68,7 +68,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole >typeof strOrBool !== 'string' && !strOrBool : boolean >typeof strOrBool !== 'string' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'string' : "string" >!strOrBool : boolean >strOrBool : boolean @@ -83,7 +83,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole >(typeof strOrBool === 'string') : boolean >typeof strOrBool === 'string' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'string' : "string" >strOrBool : string >"string" : string @@ -105,7 +105,7 @@ if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boole >(typeof strOrBool !== 'boolean') : boolean >typeof strOrBool !== 'boolean' : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >'boolean' : "boolean" >strOrBool : string >"string" : string diff --git a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types index 0b1661820d5..b24b63f61dc 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types +++ b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types @@ -26,7 +26,7 @@ var c: C; >C : C var cOrBool: C| boolean; ->cOrBool : C | boolean +>cOrBool : boolean | C >C : C var strOrNumOrBoolOrC: string | number | boolean | C; @@ -95,11 +95,11 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe >typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "number" : boolean >typeof strOrNumOrBoolOrC !== "string" : boolean >typeof strOrNumOrBoolOrC : string ->strOrNumOrBoolOrC : C | string | number | boolean +>strOrNumOrBoolOrC : string | number | boolean | C >"string" : "string" >typeof strOrNumOrBoolOrC !== "number" : boolean >typeof strOrNumOrBoolOrC : string ->strOrNumOrBoolOrC : C | number | boolean +>strOrNumOrBoolOrC : number | boolean | C >"number" : "number" >typeof strOrNumOrBool === "boolean" : boolean >typeof strOrNumOrBool : string @@ -107,9 +107,9 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe >"boolean" : "boolean" cOrBool = strOrNumOrBoolOrC; // C | boolean ->cOrBool = strOrNumOrBoolOrC : C | boolean ->cOrBool : C | boolean ->strOrNumOrBoolOrC : C | boolean +>cOrBool = strOrNumOrBoolOrC : boolean | C +>cOrBool : boolean | C +>strOrNumOrBoolOrC : boolean | C bool = strOrNumOrBool; // boolean >bool = strOrNumOrBool : boolean @@ -120,7 +120,7 @@ else { var r1: string | number | boolean | C = strOrNumOrBoolOrC; // string | number | boolean | C >r1 : string | number | boolean | C >C : C ->strOrNumOrBoolOrC : string | number | C | boolean +>strOrNumOrBoolOrC : string | number | boolean | C var r2: string | number | boolean = strOrNumOrBool; >r2 : string | number | boolean diff --git a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types index b576630c1cf..eb428bcb679 100644 --- a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types +++ b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types @@ -26,7 +26,7 @@ var c: C; >C : C var cOrBool: C| boolean; ->cOrBool : C | boolean +>cOrBool : boolean | C >C : C var strOrNumOrBoolOrC: string | number | boolean | C; @@ -118,7 +118,7 @@ if (typeof strOrNumOrBoolOrC === "string" || typeof strOrNumOrBoolOrC === "numbe else { cOrBool = strOrNumOrBoolOrC; // C | boolean >cOrBool = strOrNumOrBoolOrC : boolean | C ->cOrBool : C | boolean +>cOrBool : boolean | C >strOrNumOrBoolOrC : boolean | C bool = strOrNumOrBool; // boolean diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.types b/tests/baselines/reference/typeGuardOfFormInstanceOf.types index 98f627866a8..8fec2d488f6 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.types @@ -60,7 +60,7 @@ num = ctor1 instanceof C2 && ctor1.p2; // C2 >num : number >ctor1 instanceof C2 && ctor1.p2 : number >ctor1 instanceof C2 : boolean ->ctor1 : C2 | C1 +>ctor1 : C1 | C2 >C2 : typeof C2 >ctor1.p2 : number >ctor1 : C2 @@ -109,7 +109,7 @@ num = ctor2 instanceof D1 && ctor2.p3; // D1 >num : number >ctor2 instanceof D1 && ctor2.p3 : number >ctor2 instanceof D1 : boolean ->ctor2 : D1 | C2 +>ctor2 : C2 | D1 >D1 : typeof D1 >ctor2.p3 : number >ctor2 : D1 @@ -127,7 +127,7 @@ str = ctor2 instanceof D1 && ctor2.p1; // D1 >p1 : string var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1 ->r2 : D1 | C2 +>r2 : C2 | D1 >D1 : D1 >C2 : C2 >ctor2 instanceof C1 && ctor2 : D1 @@ -192,14 +192,14 @@ else { } var ctor5: C1 | D1 | C2; ->ctor5 : C1 | D1 | C2 +>ctor5 : C1 | C2 | D1 >C1 : C1 >D1 : D1 >C2 : C2 if (ctor5 instanceof C1) { >ctor5 instanceof C1 : boolean ->ctor5 : C1 | D1 | C2 +>ctor5 : C1 | C2 | D1 >C1 : typeof C1 ctor5.p1; // C1 diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types index a5387e66d44..fe23d6d303e 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types @@ -84,7 +84,7 @@ num = c1Orc2 instanceof c2 && c1Orc2.p2; // C2 >num : number >c1Orc2 instanceof c2 && c1Orc2.p2 : number >c1Orc2 instanceof c2 : boolean ->c1Orc2 : C2 | C1 +>c1Orc2 : C1 | C2 >c2 : C2 >c1Orc2.p2 : number >c1Orc2 : C2 @@ -133,7 +133,7 @@ num = c2Ord1 instanceof d1 && c2Ord1.p3; // D1 >num : number >c2Ord1 instanceof d1 && c2Ord1.p3 : number >c2Ord1 instanceof d1 : boolean ->c2Ord1 : D1 | C2 +>c2Ord1 : C2 | D1 >d1 : D1 >c2Ord1.p3 : number >c2Ord1 : D1 @@ -151,7 +151,7 @@ str = c2Ord1 instanceof d1 && c2Ord1.p1; // D1 >p1 : string var r2: D1 | C2 = c2Ord1 instanceof c1 && c2Ord1; // C2 | D1 ->r2 : D1 | C2 +>r2 : C2 | D1 >D1 : D1 >C2 : C2 >c2Ord1 instanceof c1 && c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardOfFormIsType.types b/tests/baselines/reference/typeGuardOfFormIsType.types index 23ce38732cd..e2059be7b63 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.types +++ b/tests/baselines/reference/typeGuardOfFormIsType.types @@ -80,7 +80,7 @@ num = isC2(c1Orc2) && c1Orc2.p2; // C2 >isC2(c1Orc2) && c1Orc2.p2 : number >isC2(c1Orc2) : boolean >isC2 : (x: any) => x is C2 ->c1Orc2 : C2 | C1 +>c1Orc2 : C1 | C2 >c1Orc2.p2 : number >c1Orc2 : C2 >p2 : number @@ -129,7 +129,7 @@ num = isD1(c2Ord1) && c2Ord1.p3; // D1 >isD1(c2Ord1) && c2Ord1.p3 : number >isD1(c2Ord1) : boolean >isD1 : (x: any) => x is D1 ->c2Ord1 : D1 | C2 +>c2Ord1 : C2 | D1 >c2Ord1.p3 : number >c2Ord1 : D1 >p3 : number diff --git a/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types b/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types index 728d3dc0e38..ea169e95413 100644 --- a/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types +++ b/tests/baselines/reference/typeGuardOfFormIsTypeOnInterfaces.types @@ -111,7 +111,7 @@ num = isC2(c1Orc2) && c1Orc2.p2; // C2 >isC2(c1Orc2) && c1Orc2.p2 : number >isC2(c1Orc2) : boolean >isC2 : (x: any) => x is C2 ->c1Orc2 : C2 | C1 +>c1Orc2 : C1 | C2 >c1Orc2.p2 : number >c1Orc2 : C2 >p2 : number @@ -160,7 +160,7 @@ num = isD1(c2Ord1) && c2Ord1.p3; // D1 >isD1(c2Ord1) && c2Ord1.p3 : number >isD1(c2Ord1) : boolean >isD1 : (x: any) => x is D1 ->c2Ord1 : D1 | C2 +>c2Ord1 : C2 | D1 >c2Ord1.p3 : number >c2Ord1 : D1 >p3 : number diff --git a/tests/baselines/reference/typeGuardOfFormNotExpr.types b/tests/baselines/reference/typeGuardOfFormNotExpr.types index 6989fa663c8..e4490d42dae 100644 --- a/tests/baselines/reference/typeGuardOfFormNotExpr.types +++ b/tests/baselines/reference/typeGuardOfFormNotExpr.types @@ -73,13 +73,13 @@ if (!(typeof strOrNumOrBool !== "string") || !(typeof strOrNumOrBool !== "number >(typeof strOrNumOrBool !== "string") : boolean >typeof strOrNumOrBool !== "string" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : boolean | string | number +>strOrNumOrBool : string | number | boolean >"string" : "string" >!(typeof strOrNumOrBool !== "number") : boolean >(typeof strOrNumOrBool !== "number") : boolean >typeof strOrNumOrBool !== "number" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : boolean | number +>strOrNumOrBool : number | boolean >"number" : "number" strOrNum = strOrNumOrBool; // string | number @@ -152,19 +152,19 @@ if (!(typeof strOrNumOrBool === "string") && numOrBool !== strOrNumOrBool) { >(typeof strOrNumOrBool === "string") : boolean >typeof strOrNumOrBool === "string" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : boolean | string | number +>strOrNumOrBool : string | number | boolean >"string" : "string" >numOrBool !== strOrNumOrBool : boolean >numOrBool : number | boolean ->strOrNumOrBool : boolean | number +>strOrNumOrBool : number | boolean numOrBool = strOrNumOrBool; // number | boolean ->numOrBool = strOrNumOrBool : boolean | number +>numOrBool = strOrNumOrBool : number | boolean >numOrBool : number | boolean ->strOrNumOrBool : boolean | number +>strOrNumOrBool : number | boolean } else { var r1: string | number | boolean = strOrNumOrBool; // string | number | boolean >r1 : string | number | boolean ->strOrNumOrBool : string | boolean | number +>strOrNumOrBool : string | number | boolean } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types index 9166b00386a..c06c16e331d 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfBoolean.types @@ -136,7 +136,7 @@ else { if (typeof strOrBool !== "boolean") { >typeof strOrBool !== "boolean" : boolean >typeof strOrBool : string ->strOrBool : boolean | string +>strOrBool : string | boolean >"boolean" : "boolean" str = strOrBool; // string @@ -153,7 +153,7 @@ else { if (typeof numOrBool !== "boolean") { >typeof numOrBool !== "boolean" : boolean >typeof numOrBool : string ->numOrBool : boolean | number +>numOrBool : number | boolean >"boolean" : "boolean" num = numOrBool; // number @@ -170,7 +170,7 @@ else { if (typeof strOrNumOrBool !== "boolean") { >typeof strOrNumOrBool !== "boolean" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : boolean | string | number +>strOrNumOrBool : string | number | boolean >"boolean" : "boolean" strOrNum = strOrNumOrBool; // string | number diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types index 736cd14e88e..17787d06486 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNumber.types @@ -134,7 +134,7 @@ else { if (typeof strOrNum !== "number") { >typeof strOrNum !== "number" : boolean >typeof strOrNum : string ->strOrNum : number | string +>strOrNum : string | number >"number" : "number" str === strOrNum; // string @@ -167,7 +167,7 @@ else { if (typeof strOrNumOrBool !== "number") { >typeof strOrNumOrBool !== "number" : boolean >typeof strOrNumOrBool : string ->strOrNumOrBool : number | string | boolean +>strOrNumOrBool : string | number | boolean >"number" : "number" strOrBool = strOrNumOrBool; // string | boolean diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types index 3dfb720d880..b87f6a2a004 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfOther.types +++ b/tests/baselines/reference/typeGuardOfFormTypeOfOther.types @@ -119,7 +119,7 @@ else { if (typeof strOrC !== "Object") { >typeof strOrC !== "Object" : boolean >typeof strOrC : string ->strOrC : C | string +>strOrC : string | C >"Object" : "Object" var r2: string = strOrC; // string @@ -135,7 +135,7 @@ else { if (typeof numOrC !== "Object") { >typeof numOrC !== "Object" : boolean >typeof numOrC : string ->numOrC : C | number +>numOrC : number | C >"Object" : "Object" var r3: number = numOrC; // number @@ -151,7 +151,7 @@ else { if (typeof boolOrC !== "Object") { >typeof boolOrC !== "Object" : boolean >typeof boolOrC : string ->boolOrC : C | boolean +>boolOrC : boolean | C >"Object" : "Object" var r4: boolean = boolOrC; // boolean diff --git a/tests/baselines/reference/typeGuardRedundancy.types b/tests/baselines/reference/typeGuardRedundancy.types index e028b4d11eb..80de5f54ace 100644 --- a/tests/baselines/reference/typeGuardRedundancy.types +++ b/tests/baselines/reference/typeGuardRedundancy.types @@ -22,8 +22,8 @@ var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; >toFixed : (fractionDigits?: number) => string var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr; ->r2 : (fractionDigits?: number) => string ->!(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr : (fractionDigits?: number) => string +>r2 : (from: number, length?: number) => string +>!(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr : (from: number, length?: number) => string >!(typeof x === "string" && typeof x === "string") : boolean >(typeof x === "string" && typeof x === "string") : boolean >typeof x === "string" && typeof x === "string" : boolean @@ -48,7 +48,7 @@ var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; >typeof x === "string" || typeof x === "string" : boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >typeof x === "string" : boolean >typeof x : string @@ -62,8 +62,8 @@ var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed; >toFixed : (fractionDigits?: number) => string var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr; ->r4 : (fractionDigits?: number) => string ->!(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr : (fractionDigits?: number) => string +>r4 : (from: number, length?: number) => string +>!(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr : (from: number, length?: number) => string >!(typeof x === "string" || typeof x === "string") : boolean >(typeof x === "string" || typeof x === "string") : boolean >typeof x === "string" || typeof x === "string" : boolean diff --git a/tests/baselines/reference/typeGuardTypeOfUndefined.types b/tests/baselines/reference/typeGuardTypeOfUndefined.types index d20eca99ca1..8e9928896a1 100644 --- a/tests/baselines/reference/typeGuardTypeOfUndefined.types +++ b/tests/baselines/reference/typeGuardTypeOfUndefined.types @@ -217,19 +217,19 @@ function test8(a: boolean | void) { } function test9(a: boolean | number) { ->test9 : (a: boolean | number) => void ->a : boolean | number +>test9 : (a: number | boolean) => void +>a : number | boolean if (typeof a !== "undefined") { >typeof a !== "undefined" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"undefined" : "undefined" if (typeof a === "boolean") { >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"boolean" : "boolean" a; @@ -242,24 +242,24 @@ function test9(a: boolean | number) { } else { a; ->a : boolean | number +>a : number | boolean } } function test10(a: boolean | number) { ->test10 : (a: boolean | number) => void ->a : boolean | number +>test10 : (a: number | boolean) => void +>a : number | boolean if (typeof a === "undefined") { >typeof a === "undefined" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"undefined" : "undefined" if (typeof a === "boolean") { >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"boolean" : "boolean" a; @@ -272,27 +272,27 @@ function test10(a: boolean | number) { } else { a; ->a : boolean | number +>a : number | boolean } } function test11(a: boolean | number) { ->test11 : (a: boolean | number) => void ->a : boolean | number +>test11 : (a: number | boolean) => void +>a : number | boolean if (typeof a === "undefined" || typeof a === "boolean") { >typeof a === "undefined" || typeof a === "boolean" : boolean >typeof a === "undefined" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"undefined" : "undefined" >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"boolean" : "boolean" a; ->a : boolean | number +>a : number | boolean } else { a; @@ -301,18 +301,18 @@ function test11(a: boolean | number) { } function test12(a: boolean | number) { ->test12 : (a: boolean | number) => void ->a : boolean | number +>test12 : (a: number | boolean) => void +>a : number | boolean if (typeof a !== "undefined" && typeof a === "boolean") { >typeof a !== "undefined" && typeof a === "boolean" : boolean >typeof a !== "undefined" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"undefined" : "undefined" >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"boolean" : "boolean" a; @@ -320,24 +320,24 @@ function test12(a: boolean | number) { } else { a; ->a : boolean | number +>a : number | boolean } } function test13(a: boolean | number | void) { ->test13 : (a: boolean | number | void) => void ->a : boolean | number | void +>test13 : (a: number | boolean | void) => void +>a : number | boolean | void if (typeof a !== "undefined") { >typeof a !== "undefined" : boolean >typeof a : string ->a : boolean | number | void +>a : number | boolean | void >"undefined" : "undefined" if (typeof a === "boolean") { >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"boolean" : "boolean" a; @@ -350,24 +350,24 @@ function test13(a: boolean | number | void) { } else { a; ->a : boolean | number | void +>a : number | boolean | void } } function test14(a: boolean | number | void) { ->test14 : (a: boolean | number | void) => void ->a : boolean | number | void +>test14 : (a: number | boolean | void) => void +>a : number | boolean | void if (typeof a === "undefined") { >typeof a === "undefined" : boolean >typeof a : string ->a : boolean | number | void +>a : number | boolean | void >"undefined" : "undefined" if (typeof a === "boolean") { >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number | void +>a : number | boolean | void >"boolean" : "boolean" a; @@ -380,27 +380,27 @@ function test14(a: boolean | number | void) { } else { a; ->a : boolean | number +>a : number | boolean } } function test15(a: boolean | number | void) { ->test15 : (a: boolean | number | void) => void ->a : boolean | number | void +>test15 : (a: number | boolean | void) => void +>a : number | boolean | void if (typeof a === "undefined" || typeof a === "boolean") { >typeof a === "undefined" || typeof a === "boolean" : boolean >typeof a === "undefined" : boolean >typeof a : string ->a : boolean | number | void +>a : number | boolean | void >"undefined" : "undefined" >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"boolean" : "boolean" a; ->a : boolean | number | void +>a : number | boolean | void } else { a; @@ -409,18 +409,18 @@ function test15(a: boolean | number | void) { } function test16(a: boolean | number | void) { ->test16 : (a: boolean | number | void) => void ->a : boolean | number | void +>test16 : (a: number | boolean | void) => void +>a : number | boolean | void if (typeof a !== "undefined" && typeof a === "boolean") { >typeof a !== "undefined" && typeof a === "boolean" : boolean >typeof a !== "undefined" : boolean >typeof a : string ->a : boolean | number | void +>a : number | boolean | void >"undefined" : "undefined" >typeof a === "boolean" : boolean >typeof a : string ->a : boolean | number +>a : number | boolean >"boolean" : "boolean" a; @@ -428,7 +428,7 @@ function test16(a: boolean | number | void) { } else { a; ->a : boolean | number | void +>a : number | boolean | void } } diff --git a/tests/baselines/reference/typeGuardsAsAssertions.types b/tests/baselines/reference/typeGuardsAsAssertions.types index 3ea84efa1c9..f24929a5348 100644 --- a/tests/baselines/reference/typeGuardsAsAssertions.types +++ b/tests/baselines/reference/typeGuardsAsAssertions.types @@ -30,9 +30,9 @@ export const none : None = { none: '' }; >'' : string export function isSome(value: Optional): value is Some { ->isSome : (value: Some | None) => value is Some +>isSome : (value: None | Some) => value is Some >a : a ->value : Some | None +>value : None | Some >Optional : Some | None >a : a >value : any @@ -42,7 +42,7 @@ export function isSome(value: Optional): value is Some { return 'some' in value; >'some' in value : boolean >'some' : string ->value : Some | None +>value : None | Some } function someFrom(some: a) { @@ -63,7 +63,7 @@ export function fn(makeSome: () => r): void { >r : r let result: Optional = none; ->result : Some | None +>result : None | Some >Optional : Some | None >r : r >none : None @@ -79,12 +79,12 @@ export function fn(makeSome: () => r): void { result = someFrom(isSome(result) ? result.some : makeSome()); >result = someFrom(isSome(result) ? result.some : makeSome()) : { some: r; } ->result : Some | None +>result : None | Some >someFrom(isSome(result) ? result.some : makeSome()) : { some: r; } >someFrom : (some: a) => { some: a; } >isSome(result) ? result.some : makeSome() : r >isSome(result) : boolean ->isSome : (value: Some | None) => value is Some +>isSome : (value: None | Some) => value is Some >result : None | Some >result.some : r >result : Some @@ -111,7 +111,7 @@ function foo1() { >cond : boolean x; // number, then string | number ->x : number | string +>x : string | number x = typeof x === "string" ? x.slice() : "abc"; >x = typeof x === "string" ? x.slice() : "abc" : string @@ -119,7 +119,7 @@ function foo1() { >typeof x === "string" ? x.slice() : "abc" : string >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >x.slice() : string >x.slice : (start?: number | undefined, end?: number | undefined) => string @@ -131,7 +131,7 @@ function foo1() { >x : string } x; ->x : number | string +>x : string | number } function foo2() { @@ -148,12 +148,12 @@ function foo2() { >cond : boolean x; // number, then string | number ->x : number | string +>x : string | number if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" x = x.slice(); @@ -174,7 +174,7 @@ function foo2() { >x : string } x; ->x : number | string +>x : string | number } // Type guards as assertions @@ -285,10 +285,10 @@ function f5(x: string | number) { } else { x; // string | number ->x : number | string +>x : string | number } x; // string | number ->x : number | string +>x : string | number } function f6() { diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.types b/tests/baselines/reference/typeGuardsInConditionalExpression.types index 3224dc48b5b..8d5da1329e6 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.types +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.types @@ -7,14 +7,14 @@ // provided the false expression contains no assignments to the variable or parameter. function foo(x: number | string) { ->foo : (x: number | string) => number ->x : number | string +>foo : (x: string | number) => number +>x : string | number return typeof x === "string" >typeof x === "string" ? x.length // string : x++ : number >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" ? x.length // string @@ -27,14 +27,14 @@ function foo(x: number | string) { >x : number } function foo2(x: number | string) { ->foo2 : (x: number | string) => string | number ->x : number | string +>foo2 : (x: string | number) => string | number +>x : string | number return typeof x === "string" >typeof x === "string" ? ((x = "hello") && x) // string : x : string | number >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" ? ((x = "hello") && x) // string @@ -42,7 +42,7 @@ function foo2(x: number | string) { >(x = "hello") && x : string >(x = "hello") : string >x = "hello" : string ->x : number | string +>x : string | number >"hello" : string >x : string @@ -50,14 +50,14 @@ function foo2(x: number | string) { >x : number } function foo3(x: number | string) { ->foo3 : (x: number | string) => number ->x : number | string +>foo3 : (x: string | number) => number +>x : string | number return typeof x === "string" >typeof x === "string" ? ((x = 10) && x) // number : x : number >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" ? ((x = 10) && x) // number @@ -65,7 +65,7 @@ function foo3(x: number | string) { >(x = 10) && x : number >(x = 10) : number >x = 10 : number ->x : number | string +>x : string | number >10 : number >x : number @@ -73,14 +73,14 @@ function foo3(x: number | string) { >x : number } function foo4(x: number | string) { ->foo4 : (x: number | string) => string | number ->x : number | string +>foo4 : (x: string | number) => string | number +>x : string | number return typeof x === "string" >typeof x === "string" ? x // string : ((x = 10) && x) : string | number >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" ? x // string @@ -91,19 +91,19 @@ function foo4(x: number | string) { >(x = 10) && x : number >(x = 10) : number >x = 10 : number ->x : number | string +>x : string | number >10 : number >x : number } function foo5(x: number | string) { ->foo5 : (x: number | string) => string ->x : number | string +>foo5 : (x: string | number) => string +>x : string | number return typeof x === "string" >typeof x === "string" ? x // string : ((x = "hello") && x) : string >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" ? x // string @@ -114,20 +114,20 @@ function foo5(x: number | string) { >(x = "hello") && x : string >(x = "hello") : string >x = "hello" : string ->x : number | string +>x : string | number >"hello" : string >x : string } function foo6(x: number | string) { ->foo6 : (x: number | string) => number | string ->x : number | string +>foo6 : (x: string | number) => string | number +>x : string | number // Modify in both branches return typeof x === "string" ->typeof x === "string" ? ((x = 10) && x) // number : ((x = "hello") && x) : number | string +>typeof x === "string" ? ((x = 10) && x) // number : ((x = "hello") && x) : string | number >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" ? ((x = 10) && x) // number @@ -135,7 +135,7 @@ function foo6(x: number | string) { >(x = 10) && x : number >(x = 10) : number >x = 10 : number ->x : number | string +>x : string | number >10 : number >x : number @@ -144,19 +144,19 @@ function foo6(x: number | string) { >(x = "hello") && x : string >(x = "hello") : string >x = "hello" : string ->x : number | string +>x : string | number >"hello" : string >x : string } function foo7(x: number | string | boolean) { ->foo7 : (x: number | string | boolean) => boolean ->x : number | string | boolean +>foo7 : (x: string | number | boolean) => boolean +>x : string | number | boolean return typeof x === "string" >typeof x === "string" ? x === "hello" // boolean : typeof x === "boolean" ? x // boolean : x == 10 : boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x === "hello" // boolean @@ -180,8 +180,8 @@ function foo7(x: number | string | boolean) { >10 : 10 } function foo8(x: number | string | boolean) { ->foo8 : (x: number | string | boolean) => boolean ->x : number | string | boolean +>foo8 : (x: string | number | boolean) => boolean +>x : string | number | boolean var b: number | boolean; >b : number | boolean @@ -190,7 +190,7 @@ function foo8(x: number | string | boolean) { >typeof x === "string" ? x === "hello" : ((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10)) : boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x === "hello" @@ -223,8 +223,8 @@ function foo8(x: number | string | boolean) { >10 : 10 } function foo9(x: number | string) { ->foo9 : (x: number | string) => boolean ->x : number | string +>foo9 : (x: string | number) => boolean +>x : string | number var y = 10; >y : number @@ -235,7 +235,7 @@ function foo9(x: number | string) { >typeof x === "string" ? ((y = x.length) && x === "hello") // boolean : x === 10 : boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" ? ((y = x.length) && x === "hello") // boolean @@ -257,18 +257,18 @@ function foo9(x: number | string) { >10 : 10 } function foo10(x: number | string | boolean) { ->foo10 : (x: number | string | boolean) => string ->x : number | string | boolean +>foo10 : (x: string | number | boolean) => string +>x : string | number | boolean // Mixing typeguards var b: boolean | number; ->b : boolean | number +>b : number | boolean return typeof x === "string" >typeof x === "string" ? x // string : ((b = x) // x is number | boolean && typeof x === "number" && x.toString()) : string >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x // string @@ -280,7 +280,7 @@ function foo10(x: number | string | boolean) { >(b = x) // x is number | boolean && typeof x === "number" : boolean >(b = x) : number | boolean >b = x : number | boolean ->b : boolean | number +>b : number | boolean >x : number | boolean && typeof x === "number" @@ -296,18 +296,18 @@ function foo10(x: number | string | boolean) { >toString : (radix?: number) => string } function foo11(x: number | string | boolean) { ->foo11 : (x: number | string | boolean) => string | number ->x : number | string | boolean +>foo11 : (x: string | number | boolean) => string | number +>x : string | number | boolean // Mixing typeguards var b: number | boolean | string; ->b : number | boolean | string +>b : string | number | boolean return typeof x === "string" >typeof x === "string" ? x // string : ((b = x) // x is number | boolean && typeof x === "number" && (x = 10) // assignment to x && x) : string | number >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x // string @@ -320,7 +320,7 @@ function foo11(x: number | string | boolean) { >(b = x) // x is number | boolean && typeof x === "number" : boolean >(b = x) : number | boolean >b = x : number | boolean ->b : number | boolean | string +>b : string | number | boolean >x : number | boolean && typeof x === "number" @@ -332,25 +332,25 @@ function foo11(x: number | string | boolean) { && (x = 10) // assignment to x >(x = 10) : number >x = 10 : number ->x : number | string | boolean +>x : string | number | boolean >10 : number && x); // x is number >x : number } function foo12(x: number | string | boolean) { ->foo12 : (x: number | string | boolean) => number ->x : number | string | boolean +>foo12 : (x: string | number | boolean) => number +>x : string | number | boolean // Mixing typeguards var b: number | boolean | string; ->b : number | boolean | string +>b : string | number | boolean return typeof x === "string" >typeof x === "string" ? ((x = 10) && x.toString().length) // number : ((b = x) // x is number | boolean && typeof x === "number" && x) : number >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? ((x = 10) && x.toString().length) // number @@ -358,7 +358,7 @@ function foo12(x: number | string | boolean) { >(x = 10) && x.toString().length : number >(x = 10) : number >x = 10 : number ->x : number | string | boolean +>x : string | number | boolean >10 : number >x.toString().length : number >x.toString() : string @@ -373,7 +373,7 @@ function foo12(x: number | string | boolean) { >(b = x) // x is number | boolean && typeof x === "number" : boolean >(b = x) : number | boolean >b = x : number | boolean ->b : number | boolean | string +>b : string | number | boolean >x : number | boolean && typeof x === "number" diff --git a/tests/baselines/reference/typeGuardsInDoStatement.types b/tests/baselines/reference/typeGuardsInDoStatement.types index 3000764051d..58b6343a2f5 100644 --- a/tests/baselines/reference/typeGuardsInDoStatement.types +++ b/tests/baselines/reference/typeGuardsInDoStatement.types @@ -13,7 +13,7 @@ function a(x: string | number | boolean) { do { x; // boolean | string ->x : boolean | string +>x : string | boolean x = undefined; >x = undefined : undefined @@ -40,7 +40,7 @@ function b(x: string | number | boolean) { do { x; // boolean | string ->x : boolean | string +>x : string | boolean if (cond) continue; >cond : boolean diff --git a/tests/baselines/reference/typeGuardsInForStatement.types b/tests/baselines/reference/typeGuardsInForStatement.types index 6a7561bb436..1d600d52d13 100644 --- a/tests/baselines/reference/typeGuardsInForStatement.types +++ b/tests/baselines/reference/typeGuardsInForStatement.types @@ -72,6 +72,6 @@ function c(x: string | number) { >cond : boolean } x; // string | number ->x : number | string +>x : string | number } diff --git a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types index 946ac9d71ed..0cb312ffb1a 100644 --- a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types +++ b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types @@ -2,14 +2,14 @@ // typeguards are scoped in function/module block function foo(x: number | string | boolean) { ->foo : (x: number | string | boolean) => string ->x : number | string | boolean +>foo : (x: string | number | boolean) => string +>x : string | number | boolean return typeof x === "string" >typeof x === "string" ? x : function f() { var b = x; // number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number } () : string >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x @@ -46,14 +46,14 @@ function foo(x: number | string | boolean) { } (); } function foo2(x: number | string | boolean) { ->foo2 : (x: number | string | boolean) => string ->x : number | string | boolean +>foo2 : (x: string | number | boolean) => string +>x : string | number | boolean return typeof x === "string" >typeof x === "string" ? x : function f(a: number | boolean) { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number } (x) : string >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x @@ -92,14 +92,14 @@ function foo2(x: number | string | boolean) { >x : number | boolean } function foo3(x: number | string | boolean) { ->foo3 : (x: number | string | boolean) => string ->x : number | string | boolean +>foo3 : (x: string | number | boolean) => string +>x : string | number | boolean return typeof x === "string" >typeof x === "string" ? x : (() => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number })() : string >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x @@ -136,14 +136,14 @@ function foo3(x: number | string | boolean) { })(); } function foo4(x: number | string | boolean) { ->foo4 : (x: number | string | boolean) => string ->x : number | string | boolean +>foo4 : (x: string | number | boolean) => string +>x : string | number | boolean return typeof x === "string" >typeof x === "string" ? x : ((a: number | boolean) => { var b = x; // new scope - number | boolean return typeof x === "boolean" ? x.toString() // boolean : x.toString(); // number })(x) : string >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" ? x @@ -183,13 +183,13 @@ function foo4(x: number | string | boolean) { } // Type guards do not affect nested function declarations function foo5(x: number | string | boolean) { ->foo5 : (x: number | string | boolean) => void ->x : number | string | boolean +>foo5 : (x: string | number | boolean) => void +>x : string | number | boolean if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" var y = x; // string; @@ -200,8 +200,8 @@ function foo5(x: number | string | boolean) { >foo : () => void var z = x; // string ->z : number | string | boolean ->x : number | string | boolean +>z : string | number | boolean +>x : string | number | boolean } } } @@ -209,14 +209,14 @@ module m { >m : typeof m var x: number | string | boolean; ->x : number | string | boolean +>x : string | number | boolean module m2 { >m2 : typeof m2 var b = x; // new scope - number | boolean | string ->b : number | string | boolean ->x : number | string | boolean +>b : string | number | boolean +>x : string | number | boolean var y: string; >y : string @@ -224,7 +224,7 @@ module m { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" y = x // string; @@ -260,15 +260,15 @@ module m1 { >m1 : typeof m1 var x: number | string | boolean; ->x : number | string | boolean +>x : string | number | boolean module m2.m3 { >m2 : typeof m2 >m3 : typeof m3 var b = x; // new scope - number | boolean | string ->b : number | string | boolean ->x : number | string | boolean +>b : string | number | boolean +>x : string | number | boolean var y: string; >y : string @@ -276,7 +276,7 @@ module m1 { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" y = x // string; diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types index 379e26fbb7e..9d22f63e764 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types @@ -2,14 +2,14 @@ // In the right operand of a && operation, // the type of a variable or parameter is narrowed by any type guard in the left operand when true. function foo(x: number | string) { ->foo : (x: number | string) => boolean ->x : number | string +>foo : (x: string | number) => boolean +>x : string | number return typeof x === "string" && x.length === 10; // string >typeof x === "string" && x.length === 10 : boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >x.length === 10 : boolean >x.length : number @@ -18,53 +18,53 @@ function foo(x: number | string) { >10 : 10 } function foo2(x: number | string) { ->foo2 : (x: number | string) => number ->x : number | string +>foo2 : (x: string | number) => number +>x : string | number // modify x in right hand operand return typeof x === "string" && ((x = 10) && x); // string | number >typeof x === "string" && ((x = 10) && x) : number >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >((x = 10) && x) : number >(x = 10) && x : number >(x = 10) : number >x = 10 : number ->x : number | string +>x : string | number >10 : number >x : number } function foo3(x: number | string) { ->foo3 : (x: number | string) => string ->x : number | string +>foo3 : (x: string | number) => string +>x : string | number // modify x in right hand operand with string type itself return typeof x === "string" && ((x = "hello") && x); // string | number >typeof x === "string" && ((x = "hello") && x) : string >typeof x === "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >((x = "hello") && x) : string >(x = "hello") && x : string >(x = "hello") : string >x = "hello" : string ->x : number | string +>x : string | number >"hello" : string >x : string } function foo4(x: number | string | boolean) { ->foo4 : (x: number | string | boolean) => boolean ->x : number | string | boolean +>foo4 : (x: string | number | boolean) => boolean +>x : string | number | boolean return typeof x !== "string" // string | number | boolean >typeof x !== "string" // string | number | boolean && typeof x !== "number" // number | boolean && x : boolean >typeof x !== "string" // string | number | boolean && typeof x !== "number" : boolean >typeof x !== "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" && typeof x !== "number" // number | boolean @@ -77,8 +77,8 @@ function foo4(x: number | string | boolean) { >x : boolean } function foo5(x: number | string | boolean) { ->foo5 : (x: number | string | boolean) => boolean ->x : number | string | boolean +>foo5 : (x: string | number | boolean) => boolean +>x : string | number | boolean // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop var b: number | boolean; @@ -88,7 +88,7 @@ function foo5(x: number | string | boolean) { >typeof x !== "string" // string | number | boolean && ((b = x) && (typeof x !== "number" // number | boolean && x)) : boolean >typeof x !== "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" && ((b = x) && (typeof x !== "number" // number | boolean @@ -109,15 +109,15 @@ function foo5(x: number | string | boolean) { >x : boolean } function foo6(x: number | string | boolean) { ->foo6 : (x: number | string | boolean) => boolean ->x : number | string | boolean +>foo6 : (x: string | number | boolean) => boolean +>x : string | number | boolean // Mixing typeguard narrowing in if statement with conditional expression typeguard return typeof x !== "string" // string | number | boolean >typeof x !== "string" // string | number | boolean && (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean >typeof x !== "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" && (typeof x !== "number" // number | boolean @@ -137,21 +137,21 @@ function foo6(x: number | string | boolean) { >10 : 10 } function foo7(x: number | string | boolean) { ->foo7 : (x: number | string | boolean) => string ->x : number | string | boolean +>foo7 : (x: string | number | boolean) => string +>x : string | number | boolean var y: number| boolean | string; ->y : number | boolean | string +>y : string | number | boolean var z: number| boolean | string; ->z : number | boolean | string +>z : string | number | boolean // Mixing typeguard narrowing return typeof x !== "string" >typeof x !== "string" && ((z = x) // number | boolean && (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString()))) : string >typeof x !== "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" && ((z = x) // number | boolean @@ -159,7 +159,7 @@ function foo7(x: number | string | boolean) { >(z = x) // number | boolean && (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString())) : string >(z = x) : number | boolean >z = x : number | boolean ->z : number | boolean | string +>z : string | number | boolean >x : number | boolean && (typeof x === "number" @@ -176,7 +176,7 @@ function foo7(x: number | string | boolean) { >(x = 10) && x.toString() : string >(x = 10) : number >x = 10 : number ->x : number | string | boolean +>x : string | number | boolean >10 : number >x.toString() : string >x.toString : (radix?: number) => string @@ -189,7 +189,7 @@ function foo7(x: number | string | boolean) { >(y = x) && x.toString() : string >(y = x) : boolean >y = x : boolean ->y : number | boolean | string +>y : string | number | boolean >x : boolean >x.toString() : string >x.toString : () => string diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types index 141fab13b3d..0cb70c8c2d6 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types @@ -3,14 +3,14 @@ // the type of a variable or parameter is narrowed by any type guard in the left operand when false, // provided the right operand contains no assignments to the variable or parameter. function foo(x: number | string) { ->foo : (x: number | string) => boolean ->x : number | string +>foo : (x: string | number) => boolean +>x : string | number return typeof x !== "string" || x.length === 10; // string >typeof x !== "string" || x.length === 10 : boolean >typeof x !== "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >x.length === 10 : boolean >x.length : number @@ -19,53 +19,53 @@ function foo(x: number | string) { >10 : 10 } function foo2(x: number | string) { ->foo2 : (x: number | string) => true | number ->x : number | string +>foo2 : (x: string | number) => number | true +>x : string | number // modify x in right hand operand return typeof x !== "string" || ((x = 10) || x); // string | number ->typeof x !== "string" || ((x = 10) || x) : true | number +>typeof x !== "string" || ((x = 10) || x) : number | true >typeof x !== "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >((x = 10) || x) : number >(x = 10) || x : number >(x = 10) : number >x = 10 : number ->x : number | string +>x : string | number >10 : number >x : number } function foo3(x: number | string) { ->foo3 : (x: number | string) => true | string ->x : number | string +>foo3 : (x: string | number) => string | true +>x : string | number // modify x in right hand operand with string type itself return typeof x !== "string" || ((x = "hello") || x); // string | number ->typeof x !== "string" || ((x = "hello") || x) : true | string +>typeof x !== "string" || ((x = "hello") || x) : string | true >typeof x !== "string" : boolean >typeof x : string ->x : number | string +>x : string | number >"string" : "string" >((x = "hello") || x) : string >(x = "hello") || x : string >(x = "hello") : string >x = "hello" : string ->x : number | string +>x : string | number >"hello" : string >x : string } function foo4(x: number | string | boolean) { ->foo4 : (x: number | string | boolean) => boolean ->x : number | string | boolean +>foo4 : (x: string | number | boolean) => boolean +>x : string | number | boolean return typeof x === "string" // string | number | boolean >typeof x === "string" // string | number | boolean || typeof x === "number" // number | boolean || x : boolean >typeof x === "string" // string | number | boolean || typeof x === "number" : boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" || typeof x === "number" // number | boolean @@ -78,18 +78,18 @@ function foo4(x: number | string | boolean) { >x : boolean } function foo5(x: number | string | boolean) { ->foo5 : (x: number | string | boolean) => boolean | number ->x : number | string | boolean +>foo5 : (x: string | number | boolean) => number | boolean +>x : string | number | boolean // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop var b: number | boolean; >b : number | boolean return typeof x === "string" // string | number | boolean ->typeof x === "string" // string | number | boolean || ((b = x) || (typeof x === "number" // number | boolean || x)) : boolean | number +>typeof x === "string" // string | number | boolean || ((b = x) || (typeof x === "number" // number | boolean || x)) : number | boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" || ((b = x) || (typeof x === "number" // number | boolean @@ -110,15 +110,15 @@ function foo5(x: number | string | boolean) { >x : boolean } function foo6(x: number | string | boolean) { ->foo6 : (x: number | string | boolean) => boolean ->x : number | string | boolean +>foo6 : (x: string | number | boolean) => boolean +>x : string | number | boolean // Mixing typeguard return typeof x === "string" // string | number | boolean >typeof x === "string" // string | number | boolean || (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" || (typeof x !== "number" // number | boolean @@ -138,29 +138,29 @@ function foo6(x: number | string | boolean) { >10 : 10 } function foo7(x: number | string | boolean) { ->foo7 : (x: number | string | boolean) => true | number | string ->x : number | string | boolean +>foo7 : (x: string | number | boolean) => string | number | true +>x : string | number | boolean var y: number| boolean | string; ->y : number | boolean | string +>y : string | number | boolean var z: number| boolean | string; ->z : number | boolean | string +>z : string | number | boolean // Mixing typeguard narrowing return typeof x === "string" ->typeof x === "string" || ((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : true | number | string +>typeof x === "string" || ((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : string | number | true >typeof x === "string" : boolean >typeof x : string ->x : number | string | boolean +>x : string | number | boolean >"string" : "string" || ((z = x) // number | boolean ->((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : number | true | string ->(z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString())) : number | true | string +>((z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString()))) : string | number | true +>(z = x) // number | boolean || (typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // number | boolean | string // do not change value : ((y = x) && x.toString())) : string | number | true >(z = x) : number | boolean >z = x : number | boolean ->z : number | boolean | string +>z : string | number | boolean >x : number | boolean || (typeof x === "number" @@ -177,7 +177,7 @@ function foo7(x: number | string | boolean) { >(x = 10) && x.toString() : string >(x = 10) : number >x = 10 : number ->x : number | string | boolean +>x : string | number | boolean >10 : number >x.toString() : string >x.toString : (radix?: number) => string @@ -190,7 +190,7 @@ function foo7(x: number | string | boolean) { >(y = x) && x.toString() : string >(y = x) : boolean >y = x : boolean ->y : number | boolean | string +>y : string | number | boolean >x : boolean >x.toString() : string >x.toString : () => string diff --git a/tests/baselines/reference/typeGuardsInWhileStatement.types b/tests/baselines/reference/typeGuardsInWhileStatement.types index 1786871f814..b0ea7959ec5 100644 --- a/tests/baselines/reference/typeGuardsInWhileStatement.types +++ b/tests/baselines/reference/typeGuardsInWhileStatement.types @@ -69,6 +69,6 @@ function c(x: string | number) { >undefined : undefined } x; // string | number ->x : number | string +>x : string | number } diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.types b/tests/baselines/reference/typeGuardsOnClassProperty.types index b4ca9c0b122..85af4540fb9 100644 --- a/tests/baselines/reference/typeGuardsOnClassProperty.types +++ b/tests/baselines/reference/typeGuardsOnClassProperty.types @@ -58,13 +58,13 @@ class D { } var o: { ->o : { prop1: number | string; prop2: boolean | string; } +>o : { prop1: string | number; prop2: string | boolean; } prop1: number|string; ->prop1 : number | string +>prop1 : string | number prop2: boolean|string; ->prop2 : boolean | string +>prop2 : string | boolean } = { >{ prop1: "string" , prop2: true } : { prop1: string; prop2: boolean; } @@ -82,28 +82,28 @@ if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {} >typeof o.prop1 === "string" && o.prop1.toLowerCase() : string >typeof o.prop1 === "string" : boolean >typeof o.prop1 : string ->o.prop1 : number | string ->o : { prop1: number | string; prop2: boolean | string; } ->prop1 : number | string +>o.prop1 : string | number +>o : { prop1: string | number; prop2: string | boolean; } +>prop1 : string | number >"string" : "string" >o.prop1.toLowerCase() : string >o.prop1.toLowerCase : () => string >o.prop1 : string ->o : { prop1: number | string; prop2: boolean | string; } +>o : { prop1: string | number; prop2: string | boolean; } >prop1 : string >toLowerCase : () => string var prop1 = o.prop1; ->prop1 : number | string ->o.prop1 : number | string ->o : { prop1: number | string; prop2: boolean | string; } ->prop1 : number | string +>prop1 : string | number +>o.prop1 : string | number +>o : { prop1: string | number; prop2: string | boolean; } +>prop1 : string | number if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } >typeof prop1 === "string" && prop1.toLocaleLowerCase() : string >typeof prop1 === "string" : boolean >typeof prop1 : string ->prop1 : number | string +>prop1 : string | number >"string" : "string" >prop1.toLocaleLowerCase() : string >prop1.toLocaleLowerCase : () => string diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt index 63b9de2aeda..c574118f91d 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'F | string'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'F | string'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'string | F'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'. @@ -158,10 +158,10 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru if (obj11 instanceof F) { // can't type narrowing, construct signature returns any. obj11.foo; ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'F | string'. +!!! error TS2339: Property 'foo' does not exist on type 'string | F'. obj11.bar; ~~~ -!!! error TS2339: Property 'bar' does not exist on type 'F | string'. +!!! error TS2339: Property 'bar' does not exist on type 'string | F'. } var obj12: any; diff --git a/tests/baselines/reference/typeParameterAsElementType.types b/tests/baselines/reference/typeParameterAsElementType.types index 3b145b7f3cf..10e6787ae31 100644 --- a/tests/baselines/reference/typeParameterAsElementType.types +++ b/tests/baselines/reference/typeParameterAsElementType.types @@ -8,8 +8,8 @@ function fee() { >T : T var arr = [t, ""]; ->arr : (T | string)[] ->[t, ""] : (T | string)[] +>arr : (string | T)[] +>[t, ""] : (string | T)[] >t : T >"" : string } diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index fcb329193f2..a1fd2888bf3 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -235,7 +235,7 @@ _.all([true, 1, null, 'yes'], _.identity); >_.all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } >_ : Underscore.Static >all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } ->[true, 1, null, 'yes'] : (boolean | number | string)[] +>[true, 1, null, 'yes'] : (string | number | boolean)[] >true : boolean >1 : number >null : null @@ -249,7 +249,7 @@ _.any([null, 0, 'yes', false]); >_.any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } >_ : Underscore.Static >any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } ->[null, 0, 'yes', false] : (number | string | boolean)[] +>[null, 0, 'yes', false] : (string | number | boolean)[] >null : null >0 : number >'yes' : string @@ -508,11 +508,11 @@ _.rest([5, 4, 3, 2, 1]); >1 : number _.compact([0, 1, false, 2, '', 3]); ->_.compact([0, 1, false, 2, '', 3]) : (number | boolean | string)[] +>_.compact([0, 1, false, 2, '', 3]) : (string | number | boolean)[] >_.compact : (list: T[]) => T[] >_ : Underscore.Static >compact : (list: T[]) => T[] ->[0, 1, false, 2, '', 3] : (number | boolean | string)[] +>[0, 1, false, 2, '', 3] : (string | number | boolean)[] >0 : number >1 : number >false : boolean diff --git a/tests/baselines/reference/unionAndIntersectionInference1.types b/tests/baselines/reference/unionAndIntersectionInference1.types index 5d23688f0b7..f3cf3611d75 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.types +++ b/tests/baselines/reference/unionAndIntersectionInference1.types @@ -13,12 +13,12 @@ var y: Y = undefined; >undefined : undefined function destructure( ->destructure : (something: a | Y, haveValue: (value: a) => r, haveY: (value: Y) => r) => r +>destructure : (something: Y | a, haveValue: (value: a) => r, haveY: (value: Y) => r) => r >a : a >r : r something: a | Y, ->something : a | Y +>something : Y | a >a : a >Y : Y @@ -40,7 +40,7 @@ function destructure( return something === y ? haveY(y) : haveValue(something); >something === y ? haveY(y) : haveValue(something) : r >something === y : boolean ->something : a | Y +>something : Y | a >y : Y >haveY(y) : r >haveY : (value: Y) => r @@ -49,7 +49,7 @@ function destructure( >haveValue : (value: a) => r >something : a >a : a ->something : a | Y +>something : Y | a } var value = Math.random() > 0.5 ? 'hey!' : undefined; @@ -69,7 +69,7 @@ var value = Math.random() > 0.5 ? 'hey!' : undefined; var result = destructure(value, text => 'string', y => 'other one'); // text: string, y: Y >result : string >destructure(value, text => 'string', y => 'other one') : string ->destructure : (something: a | Y, haveValue: (value: a) => r, haveY: (value: Y) => r) => r +>destructure : (something: Y | a, haveValue: (value: a) => r, haveY: (value: Y) => r) => r >value : string | Y >text => 'string' : (text: string) => string >text : string @@ -146,14 +146,14 @@ function baz1(value: void|a): void { // Repro from #5417 type Maybe = T | void; ->Maybe : T | void +>Maybe : void | T >T : T >T : T function get(x: U | void): U { ->get : (x: U | void) => U +>get : (x: void | U) => U >U : U ->x : U | void +>x : void | U >U : U >U : U @@ -163,13 +163,13 @@ function get(x: U | void): U { let foo: Maybe; >foo : string | void ->Maybe : T | void +>Maybe : void | T get(foo).toUpperCase(); // Ok >get(foo).toUpperCase() : string >get(foo).toUpperCase : () => string >get(foo) : string ->get : (x: U | void) => U +>get : (x: void | U) => U >foo : string | void >toUpperCase : () => string diff --git a/tests/baselines/reference/unionAndIntersectionInference2.types b/tests/baselines/reference/unionAndIntersectionInference2.types index beeb2a261f3..afe569e6d02 100644 --- a/tests/baselines/reference/unionAndIntersectionInference2.types +++ b/tests/baselines/reference/unionAndIntersectionInference2.types @@ -1,8 +1,8 @@ === tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference2.ts === declare function f1(x: T | string): T; ->f1 : (x: T | string) => T +>f1 : (x: string | T) => T >T : T ->x : T | string +>x : string | T >T : T >T : T @@ -13,39 +13,39 @@ var b1: string | string[]; >b1 : string | string[] var c1: string[] | string; ->c1 : string[] | string +>c1 : string | string[] var d1: string | { name: string }; >d1 : string | { name: string; } >name : string var e1: number | string | boolean; ->e1 : number | string | boolean +>e1 : string | number | boolean f1(a1); // string >f1(a1) : string ->f1 : (x: T | string) => T +>f1 : (x: string | T) => T >a1 : string f1(b1); // string[] >f1(b1) : string[] ->f1 : (x: T | string) => T +>f1 : (x: string | T) => T >b1 : string | string[] f1(c1); // string[] >f1(c1) : string[] ->f1 : (x: T | string) => T ->c1 : string[] | string +>f1 : (x: string | T) => T +>c1 : string | string[] f1(d1); // { name: string } >f1(d1) : { name: string; } ->f1 : (x: T | string) => T +>f1 : (x: string | T) => T >d1 : string | { name: string; } f1(e1); // number | boolean >f1(e1) : number | boolean ->f1 : (x: T | string) => T ->e1 : number | string | boolean +>f1 : (x: string | T) => T +>e1 : string | number | boolean declare function f2(x: T & { name: string }): T; >f2 : (x: T & { name: string; }) => T diff --git a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt index 7916c82c59b..013b5d9a990 100644 --- a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt +++ b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt @@ -1,34 +1,34 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(15,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(21,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'string'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(22,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'string'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(22,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(28,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'boolean'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(29,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'boolean'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(29,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'boolean'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(35,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'Date'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(36,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'Date'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(36,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'Date'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(42,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'RegExp'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(43,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'RegExp'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(43,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'RegExp'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(49,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '{ bar: number; }'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(50,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type '{ bar: number; }'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(50,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type '{ bar: number; }'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(56,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'number[]'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(57,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'number[]'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(57,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'number[]'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(63,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'I8'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(64,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'I8'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(64,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'I8'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(70,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'A'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(71,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'A'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(71,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'A'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(77,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'A2'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(78,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'A2'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(78,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'A2'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(84,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '(x: any) => number'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(85,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type '(x: any) => number'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(85,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type '(x: any) => number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(91,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '(x: T) => T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(92,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type '(x: T) => T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(92,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(99,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'E2'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(100,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'E2'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(100,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'E2'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(110,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'typeof f'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(111,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'typeof f'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(111,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'typeof f'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(121,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'typeof c'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(122,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'typeof c'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(122,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'typeof c'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(128,5): error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'T'. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(129,5): error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'T'. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts(129,5): error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'T'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubtypeIfEveryConstituentTypeIsSubtype.ts (31 errors) ==== @@ -59,7 +59,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'string'. foo2: e | number; // error e and number both not subtype of string ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'string'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'string'. } // error cases @@ -70,7 +70,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'boolean'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'boolean'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'boolean'. } @@ -81,7 +81,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'Date'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'Date'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'Date'. } @@ -92,7 +92,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'RegExp'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'RegExp'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'RegExp'. } @@ -103,7 +103,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '{ bar: number; }'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type '{ bar: number; }'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type '{ bar: number; }'. } @@ -114,7 +114,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'number[]'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'number[]'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'number[]'. } @@ -125,7 +125,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'I8'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'I8'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'I8'. } class A { foo: number; } @@ -136,7 +136,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'A'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'A'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'A'. } class A2 { foo: T; } @@ -147,7 +147,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'A2'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'A2'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'A2'. } @@ -158,7 +158,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '(x: any) => number'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type '(x: any) => number'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type '(x: any) => number'. } @@ -169,7 +169,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type '(x: T) => T'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type '(x: T) => T'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type '(x: T) => T'. } @@ -181,7 +181,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'E2'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'E2'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'E2'. } @@ -196,7 +196,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'typeof f'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'typeof f'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'typeof f'. } @@ -211,7 +211,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'typeof c'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'typeof c'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'typeof c'. } @@ -222,7 +222,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/unionSubty !!! error TS2411: Property 'foo' of type 'string | number' is not assignable to string index type 'T'. foo2: e | number; ~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'T'. +!!! error TS2411: Property 'foo2' of type 'number | e' is not assignable to string index type 'T'. } interface I19 { diff --git a/tests/baselines/reference/unionTypeCallSignatures2.types b/tests/baselines/reference/unionTypeCallSignatures2.types index 64295c1b452..ce49e9ba1c7 100644 --- a/tests/baselines/reference/unionTypeCallSignatures2.types +++ b/tests/baselines/reference/unionTypeCallSignatures2.types @@ -71,8 +71,8 @@ var n1 = f1(42); // number >42 : number var s1 = f1("abc"); // boolean | string | number ->s1 : boolean | string | number ->f1("abc") : boolean | string | number +>s1 : string | number | boolean +>f1("abc") : string | number | boolean >f1 : A | B | C >"abc" : string @@ -85,7 +85,7 @@ var a1 = f1([true, false]); // boolean[] >false : boolean var f2: C | B | A; ->f2 : C | B | A +>f2 : A | B | C >C : C >B : B >A : A @@ -93,25 +93,25 @@ var f2: C | B | A; var n2 = f2(42); // number >n2 : number >f2(42) : number ->f2 : C | B | A +>f2 : A | B | C >42 : number var s2 = f2("abc"); // number | string | boolean ->s2 : number | string | boolean ->f2("abc") : number | string | boolean ->f2 : C | B | A +>s2 : string | number | boolean +>f2("abc") : string | number | boolean +>f2 : A | B | C >"abc" : string var a2 = f2([true, false]); // boolean[] >a2 : boolean[] >f2([true, false]) : boolean[] ->f2 : C | B | A +>f2 : A | B | C >[true, false] : boolean[] >true : boolean >false : boolean var f3: B | A | C; ->f3 : B | A | C +>f3 : A | B | C >B : B >A : A >C : C @@ -119,19 +119,19 @@ var f3: B | A | C; var n3 = f3(42); // number >n3 : number >f3(42) : number ->f3 : B | A | C +>f3 : A | B | C >42 : number var s3 = f3("abc"); // string | boolean | number ->s3 : string | boolean | number ->f3("abc") : string | boolean | number ->f3 : B | A | C +>s3 : string | number | boolean +>f3("abc") : string | number | boolean +>f3 : A | B | C >"abc" : string var a3 = f3([true, false]); // boolean[] >a3 : boolean[] >f3([true, false]) : boolean[] ->f3 : B | A | C +>f3 : A | B | C >[true, false] : boolean[] >true : boolean >false : boolean diff --git a/tests/baselines/reference/unionTypeIndexSignature.types b/tests/baselines/reference/unionTypeIndexSignature.types index 953a5f434fa..6360e4b7b61 100644 --- a/tests/baselines/reference/unionTypeIndexSignature.types +++ b/tests/baselines/reference/unionTypeIndexSignature.types @@ -30,21 +30,21 @@ numOrDate = unionOfDifferentReturnType[10]; // number | Date >10 : number var unionOfTypesWithAndWithoutStringSignature: { [a: string]: number; } | boolean; ->unionOfTypesWithAndWithoutStringSignature : { [a: string]: number; } | boolean +>unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; } >a : string anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature["hello"] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature["hello"] : any ->unionOfTypesWithAndWithoutStringSignature : { [a: string]: number; } | boolean +>unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; } >"hello" : string anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature[10] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature[10] : any ->unionOfTypesWithAndWithoutStringSignature : { [a: string]: number; } | boolean +>unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; } >10 : number // If each type in U has a numeric index signature, @@ -70,20 +70,20 @@ numOrDate = unionOfDifferentReturnType1[10]; // number | Date >10 : number var unionOfTypesWithAndWithoutStringSignature1: { [a: number]: number; } | boolean; ->unionOfTypesWithAndWithoutStringSignature1 : { [a: number]: number; } | boolean +>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; } >a : number anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature1["hello"] : any ->unionOfTypesWithAndWithoutStringSignature1 : { [a: number]: number; } | boolean +>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; } >"hello" : string anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature1[10] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature1[10] : any ->unionOfTypesWithAndWithoutStringSignature1 : { [a: number]: number; } | boolean +>unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; } >10 : number diff --git a/tests/baselines/reference/unionTypeInference.types b/tests/baselines/reference/unionTypeInference.types index ff204cfdac9..efc150da918 100644 --- a/tests/baselines/reference/unionTypeInference.types +++ b/tests/baselines/reference/unionTypeInference.types @@ -43,7 +43,7 @@ var a3 = f(1, a1 || "hello"); >f(1, a1 || "hello") : number >f : (x: T, y: string | T) => T >1 : number ->a1 || "hello" : number | string +>a1 || "hello" : string | number >a1 : number >"hello" : string diff --git a/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt b/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt index 33b20183b5e..52ce842a904 100644 --- a/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt +++ b/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt @@ -8,8 +8,8 @@ tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(42,5): err tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(43,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Protected'. tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(44,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Private'. tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(45,5): error TS2339: Property 'member' does not exist on type 'Default | Protected | Private'. -tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(46,5): error TS2339: Property 'member' does not exist on type 'Public | Private | Protected'. -tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(47,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Private | Protected'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(46,5): error TS2339: Property 'member' does not exist on type 'Public | Protected | Private'. +tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(47,5): error TS2339: Property 'member' does not exist on type 'Default | Public | Protected | Private'. ==== tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts (12 errors) ==== @@ -80,8 +80,8 @@ tests/cases/conformance/types/union/unionTypePropertyAccessibility.ts(47,5): err !!! error TS2339: Property 'member' does not exist on type 'Default | Protected | Private'. v14.member; ~~~~~~ -!!! error TS2339: Property 'member' does not exist on type 'Public | Private | Protected'. +!!! error TS2339: Property 'member' does not exist on type 'Public | Protected | Private'. v15.member; ~~~~~~ -!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Private | Protected'. +!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Protected | Private'. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types index f609301c19c..361a3e90535 100644 --- a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types @@ -39,7 +39,7 @@ var t: Class | Property; >Property : Property t.parent; ->t.parent : Namespace | Module | Class +>t.parent : Module | Class | Namespace >t : Class | Property ->parent : Namespace | Module | Class +>parent : Module | Class | Namespace diff --git a/tests/baselines/reference/unionTypesAssignability.errors.txt b/tests/baselines/reference/unionTypesAssignability.errors.txt index 5be1ff3d246..7397105d317 100644 --- a/tests/baselines/reference/unionTypesAssignability.errors.txt +++ b/tests/baselines/reference/unionTypesAssignability.errors.txt @@ -7,10 +7,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(22,1): error TS2322: Type 'D | E' is not assignable to type 'E'. Type 'D' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(24,1): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(25,1): error TS2322: Type 'number | string' is not assignable to type 'number'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(25,1): error TS2322: Type 'string | number' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(26,1): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(28,1): error TS2322: Type 'number | string' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(28,1): error TS2322: Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(31,1): error TS2322: Type 'C' is not assignable to type 'D'. Property 'foo1' is missing in type 'C'. @@ -71,7 +71,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp !!! error TS2322: Type 'string' is not assignable to type 'number'. num = unionNumberString; // error string is not assignable to number ~~~ -!!! error TS2322: Type 'number | string' is not assignable to type 'number'. +!!! error TS2322: Type 'string | number' is not assignable to type 'number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. str = num; ~~~ @@ -79,7 +79,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp str = str; str = unionNumberString; // error since number is not assignable to string ~~~ -!!! error TS2322: Type 'number | string' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. // A type T is assignable to a union type U if T is assignable to any type in U diff --git a/tests/baselines/reference/unusedLocalsAndParametersTypeAliases.types b/tests/baselines/reference/unusedLocalsAndParametersTypeAliases.types index 82c87deb7d0..3dd7b3d1b2d 100644 --- a/tests/baselines/reference/unusedLocalsAndParametersTypeAliases.types +++ b/tests/baselines/reference/unusedLocalsAndParametersTypeAliases.types @@ -43,7 +43,7 @@ var x: handler5; >handler5 : (() => void) | (() => number) x(); ->x() : void | number +>x() : number | void >x : (() => void) | (() => number) // used as type argument