diff --git a/tests/baselines/reference/ES5For-of30.errors.txt b/tests/baselines/reference/ES5For-of30.errors.txt index e99b8284bf3..ee2d14a4f58 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 'string | number' is not an array type. +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,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 'string | number' is not an array type. +!!! error TS2461: Type 'number | string' 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 635bb09616a..57a28b6612c 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 'string | number' is not assignable to type 'string'. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'number | string' 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 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | string' 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 ed3d13f3918..f24aa54c7f3 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 : string | number +>v : number | string >union : string | number[] diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt index 156eb188803..3f382d72a08 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 'number | symbol | string[]' is not an array type. +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 (1 errors) ==== var union: string | string[] | number | symbol; for (let v of union) { } ~~~~~ -!!! error TS2461: Type 'number | symbol | string[]' is not an array type. \ No newline at end of file +!!! error TS2461: Type 'string[] | number | symbol' 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 61cce562ba5..453ec220f02 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: string | Color) => void ->x : string | Color +>f1 : (x: Color | string) => void +>x : Color | string >Color : Color if (typeof x === "number") { >typeof x === "number" : boolean >typeof x : string ->x : string | Color +>x : Color | string >"number" : string var y = x; @@ -35,14 +35,14 @@ function f1(x: Color | string) { } function f2(x: Color | string | string[]) { ->f2 : (x: string | Color | string[]) => void ->x : string | Color | string[] +>f2 : (x: Color | string | string[]) => void +>x : Color | string | string[] >Color : Color if (typeof x === "object") { >typeof x === "object" : boolean >typeof x : string ->x : string | Color | string[] +>x : Color | string | string[] >"object" : string 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 : Color | string | string[] >"number" : string var z = x; @@ -77,7 +77,7 @@ function f2(x: Color | string | string[]) { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | Color | string[] +>x : Color | string | string[] >"string" : string var a = x; diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index e99114bc141..9b05aff5ac6 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -769,22 +769,22 @@ module NonEmptyTypes { >base2 : typeof base2 var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : (iface | base | base2)[] ->[baseObj, base2Obj, ifaceObj] : (iface | base | base2)[] +>b1 : (base | base2 | iface)[] +>[baseObj, base2Obj, ifaceObj] : (base | base2 | iface)[] >baseObj : base >base2Obj : base2 >ifaceObj : iface var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : (iface | base | base2)[] ->[base2Obj, baseObj, ifaceObj] : (iface | base | base2)[] +>b2 : (base2 | base | iface)[] +>[base2Obj, baseObj, ifaceObj] : (base2 | base | iface)[] >base2Obj : base2 >baseObj : base >ifaceObj : iface var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : (iface | base | base2)[] ->[baseObj, ifaceObj, base2Obj] : (iface | base | base2)[] +>b3 : (base | iface | base2)[] +>[baseObj, ifaceObj, base2Obj] : (base | iface | base2)[] >baseObj : base >ifaceObj : iface >base2Obj : base2 diff --git a/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt b/tests/baselines/reference/arrayLiteralExpressionContextualTyping.errors.txt index 3e9777aea7c..72ba1411320 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 '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' 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 '() => string | number' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! 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' 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 b2f83729030..5b5a1be6b8a 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; y?: number; } | { x: number; z?: number; })[] ->[b, a] : ({ x: number; y?: number; } | { x: number; z?: number; })[] +>bs : ({ x: number; z?: number; } | { x: number; y?: number; })[] +>[b, a] : ({ x: number; z?: number; } | { x: number; y?: 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 6eae997f465..a9cf31611c2 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 : (string | number)[] ->[, , , ...a0, "hello"] : (string | number)[] +>a2 : (number | string)[] +>[, , , ...a0, "hello"] : (number | string)[] > : undefined > : undefined > : undefined @@ -151,8 +151,8 @@ interface myArray2 extends Array { } >String : String var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] ->d0 : (string | number | boolean)[] ->[1, true, ...temp,] : (string | number | boolean)[] +>d0 : (number | boolean | string)[] +>[1, true, ...temp,] : (number | boolean | string)[] >1 : number >true : boolean >...temp : string @@ -214,8 +214,8 @@ var d8: number[][] = [[...temp1]] >temp1 : number[] var d9 = [[...temp1], ...["hello"]]; ->d9 : (string | number[])[] ->[[...temp1], ...["hello"]] : (string | number[])[] +>d9 : (number[] | string)[] +>[[...temp1], ...["hello"]] : (number[] | string)[] >[...temp1] : number[] >...temp1 : number >temp1 : number[] diff --git a/tests/baselines/reference/arrayLiterals2ES6.types b/tests/baselines/reference/arrayLiterals2ES6.types index f05b0ca9282..b6bf4f1de1b 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 : (string | number)[] ->[, , , ...a0, "hello"] : (string | number)[] +>a2 : (number | string)[] +>[, , , ...a0, "hello"] : (number | string)[] > : undefined > : undefined > : undefined @@ -140,8 +140,8 @@ interface myArray2 extends Array { } >String : String var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[] ->d0 : (string | number | boolean)[] ->[1, true, ...temp, ] : (string | number | boolean)[] +>d0 : (number | boolean | string)[] +>[1, true, ...temp, ] : (number | boolean | string)[] >1 : number >true : boolean >...temp : string @@ -176,10 +176,10 @@ var d4: myArray2 = [...temp, ...temp1]; >temp1 : number[] var d5 = [...a2]; ->d5 : (string | number)[] ->[...a2] : (string | number)[] ->...a2 : string | number ->a2 : (string | number)[] +>d5 : (number | string)[] +>[...a2] : (number | string)[] +>...a2 : number | string +>a2 : (number | string)[] var d6 = [...a3]; >d6 : number[] @@ -201,8 +201,8 @@ var d8: number[][] = [[...temp1]] >temp1 : number[] var d9 = [[...temp1], ...["hello"]]; ->d9 : (string | number[])[] ->[[...temp1], ...["hello"]] : (string | number[])[] +>d9 : (number[] | string)[] +>[[...temp1], ...["hello"]] : (number[] | string)[] >[...temp1] : number[] >...temp1 : number >temp1 : number[] diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index 36714162de0..637fb3e3bc4 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -5,18 +5,18 @@ 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 '() => string | number | boolean' is not assignable to type '() => number'. - Type 'string | number | boolean' is not assignable to type 'number'. + Type '() => number | string | boolean' is not assignable to type '() => number'. + Type 'number | string | 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 '(string | number)[]' is not assignable to type 'myArray'. +tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'. Types of property 'push' are incompatible. - Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'. + Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. Types of parameters 'items' and 'items' are incompatible. - Type 'string | number' is not assignable to type 'Number'. + Type 'number | string' is not assignable to type 'Number'. Type 'string' is not assignable to type 'Number'. Property 'toFixed' is missing in type 'String'. @@ -49,8 +49,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 '() => string | number | boolean' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'number'. +!!! 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' is not assignable to type 'number'. // The resulting type an array literal expression is determined as follows: @@ -76,11 +76,11 @@ 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 '(string | number)[]' is not assignable to type 'myArray'. +!!! error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'. !!! error TS2322: Types of property 'push' are incompatible. -!!! error TS2322: Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'. +!!! error TS2322: Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. !!! error TS2322: Types of parameters 'items' and 'items' are incompatible. -!!! error TS2322: Type 'string | number' is not assignable to type 'Number'. +!!! error TS2322: Type 'number | string' is not assignable to type 'Number'. !!! error TS2322: Type 'string' is not assignable to type 'Number'. !!! error TS2322: Property 'toFixed' is missing in type 'String'. \ No newline at end of file diff --git a/tests/baselines/reference/asOperator1.types b/tests/baselines/reference/asOperator1.types index 3f69871ea09..cc8a49ddc55 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 : string | number ->32 as number|string : string | number +>j : number | string +>32 as number|string : number | string >32 : number j = ''; >j = '' : string ->j : string | number +>j : number | string >'' : string diff --git a/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt b/tests/baselines/reference/assignmentCompatBetweenTupleAndArray.errors.txt index 03dcee9baf3..c7552c3fdb2 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 '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' 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 '() => string | number' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! 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' 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 fc7bef8a28c..d0b5b6ccfd0 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 : string | number +>a : number | string 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,29 +16,29 @@ 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 : string | number +>await_a : number | string >a : any let await_b = await b; ->await_b : string | number +>await_b : number | string >b : any let await_c = await c; ->await_c : string | number +>await_c : number | string >c : any let await_d = await d; ->await_d : string | number +>await_d : number | string >d : any let await_e = await e; ->await_e : string | number +>await_e : number | string >e : any } diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types index bbdc5afe931..933d46cc802 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; y?: number; } | { x: number; z?: number; } ->true ? b : a : { x: number; y?: number; } | { x: number; z?: number; } +>r5 : { x: number; z?: number; } | { x: number; y?: number; } +>true ? b : a : { x: number; z?: number; } | { x: number; y?: number; } >true : boolean >b : { x: number; z?: number; } >a : { x: number; y?: number; } diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types index 6aa84f37eba..7d3330f4863 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 : number | E1 | E2 ->t4[3] : number | E1 | E2 +>e4 : E1 | E2 | number +>t4[3] : E1 | E2 | number >t4 : [E1, E2, number] >3 : number diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.types b/tests/baselines/reference/bestCommonTypeOfTuple2.types index 864d3030d88..573e3466376 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 : base | C ->t1[4] : base | C +>e11 : C | base +>t1[4] : C | base >t1 : [C, base] >4 : number @@ -90,8 +90,8 @@ var e41 = t4[2]; // base1 >2 : number var e51 = t5[2]; // {} ->e51 : F | C1 ->t5[2] : F | C1 +>e51 : C1 | F +>t5[2] : C1 | F >t5 : [C1, F] >2 : number diff --git a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types index ce75da3fab9..4c47753a90d 100644 --- a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types @@ -34,36 +34,36 @@ var b1 = [x, y, z]; >z : Z var b2 = [x, z, y]; ->b2 : (X | Y | Z)[] ->[x, z, y] : (X | Y | Z)[] +>b2 : (X | Z | Y)[] +>[x, z, y] : (X | Z | Y)[] >x : X >z : Z >y : Y var b3 = [y, x, z]; ->b3 : (X | Y | Z)[] ->[y, x, z] : (X | Y | Z)[] +>b3 : (Y | X | Z)[] +>[y, x, z] : (Y | X | Z)[] >y : Y >x : X >z : Z var b4 = [y, z, x]; ->b4 : (X | Y | Z)[] ->[y, z, x] : (X | Y | Z)[] +>b4 : (Y | Z | X)[] +>[y, z, x] : (Y | Z | X)[] >y : Y >z : Z >x : X var b5 = [z, x, y]; ->b5 : (X | Y | Z)[] ->[z, x, y] : (X | Y | Z)[] +>b5 : (Z | X | Y)[] +>[z, x, y] : (Z | X | Y)[] >z : Z >x : X >y : Y var b6 = [z, y, x]; ->b6 : (X | Y | Z)[] ->[z, y, x] : (X | Y | Z)[] +>b6 : (Z | Y | X)[] +>[z, y, x] : (Z | Y | X)[] >z : Z >y : Y >x : X diff --git a/tests/baselines/reference/callWithSpread.types b/tests/baselines/reference/callWithSpread.types index f7097727204..8964708c05e 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"] : string | number ->[1, 2, "abc"] : (string | number)[] +>...[1, 2, "abc"] : number | string +>[1, 2, "abc"] : (number | string)[] >1 : number >2 : number >"abc" : string diff --git a/tests/baselines/reference/callWithSpreadES6.types b/tests/baselines/reference/callWithSpreadES6.types index ba638207e8a..9c9e795ce24 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"] : string | number ->[1, 2, "abc"] : (string | number)[] +>...[1, 2, "abc"] : number | string +>[1, 2, "abc"] : (number | string)[] >1 : number >2 : number >"abc" : string diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 98be259964d..62a36c9c156 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -8,11 +8,12 @@ tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Neithe tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. Types of property '0' are incompatible. Type 'C' is not assignable to type 'A'. + Property 'a' is missing in type 'C'. tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. tests/cases/conformance/types/tuple/castingTuple.ts(30,14): error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'. @@ -61,14 +62,15 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot !!! error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. !!! error TS2352: Types of property '0' are incompatible. !!! error TS2352: Type 'C' is not assignable to type 'A'. +!!! error TS2352: Property 'a' is missing in type 'C'. var array1 = numStrTuple; ~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other. !!! error TS2352: Types of property 'pop' are incompatible. -!!! error TS2352: Type '() => string | number' is not assignable to type '() => number'. -!!! error TS2352: Type 'string | number' is not assignable to type 'number'. +!!! error TS2352: Type '() => number | string' is not assignable to type '() => number'. +!!! error TS2352: Type 'number | string' is not assignable to type 'number'. !!! error TS2352: Type 'string' is not assignable to type 'number'. t4[2] = 10; ~~ diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index d6c97b5db81..a3a393fba0c 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 | number | boolean | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | 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 72a1d5ba04f..4abefe44843 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 | number | boolean | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | 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 5674f6aa393..ae1004c9819 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_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]}) : number | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types index 93558c075e7..e98e0fb8941 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_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]}) : number | (() => void) | number[] +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: (() => void) | number | number[]; 0: () => void; p: string; } p: "", >p : string diff --git a/tests/baselines/reference/conditionalExpression1.errors.txt b/tests/baselines/reference/conditionalExpression1.errors.txt index 0e291986785..49ed2095353 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 'string | number' is not assignable to type 'boolean'. - Type 'string' is not assignable to type 'boolean'. +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 errors) ==== var x: boolean = (true ? 1 : ""); // should be an error ~ -!!! 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 +!!! 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 diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types index fe27f05df03..d5530f98fe8 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types @@ -45,7 +45,7 @@ var result1 = true ? x : a; //Expr1 and Expr2 are literals true ? {} : 1; ->true ? {} : 1 : number | {} +>true ? {} : 1 : {} | number >true : boolean >{} : {} >1 : number @@ -63,8 +63,8 @@ true ? { a: 1 } : { a: 2, b: 'string' }; >'string' : string var result2 = true ? {} : 1; ->result2 : number | {} ->true ? {} : 1 : number | {} +>result2 : {} | number +>true ? {} : 1 : {} | number >true : boolean >{} : {} >1 : number @@ -111,14 +111,14 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; //Cond ? Expr1 : Expr2, Expr2 is supertype //Be Not contextually typed true ? a : x; ->true ? a : x : X | A +>true ? a : x : A | X >true : boolean >a : A >x : X var result5 = true ? a : x; ->result5 : X | A ->true ? a : x : X | A +>result5 : A | X +>true ? a : x : A | X >true : boolean >a : A >x : X @@ -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' : string | number +>true ? 1 : 'string' : number | string >true : boolean >1 : number >'string' : string diff --git a/tests/baselines/reference/contextualSignatureInstantiation.types b/tests/baselines/reference/contextualSignatureInstantiation.types index 49d6871804c..dd88a00ae3a 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 : string | number +>b : number | string var b = foo(g); // Should be number | string ->b : string | number ->foo(g) : string | number +>b : number | string +>foo(g) : number | string >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 : string | number ->bar(1, "one", g) : string | number +>b : number | string +>bar(1, "one", g) : number | string >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 : string | number +>b : number | string >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 : string | number ->baz(b, b, g) : string | number +>b : number | string +>baz(b, b, g) : number | string >baz : (x: T, y: T, cb: (x: T, y: T) => U) => U ->b : string | number ->b : string | number +>b : number | string +>b : number | string >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) : number[] | string[] +>bar("one", 1, h) : string[] | number[] >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 ff9ace5a2c0..e447ed62b39 100644 --- a/tests/baselines/reference/contextualTypeWithTuple.errors.txt +++ b/tests/baselines/reference/contextualTypeWithTuple.errors.txt @@ -1,9 +1,9 @@ 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 '() => string | number | boolean' is not assignable to type '() => string | number'. - Type 'string | number | boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'number'. + Type '() => number | string | boolean' is not assignable to type '() => number | string'. + Type 'number | string | boolean' is not assignable to type 'number | string'. + Type 'boolean' is not assignable to type 'number | string'. + Type 'boolean' is not assignable to type 'string'. 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. @@ -31,10 +31,10 @@ 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 '() => 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 'boolean' is not assignable to type 'string | number'. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. +!!! 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 'boolean' is not assignable to type 'number | string'. +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. 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 d40192c6240..362ead49ad3 100644 --- a/tests/baselines/reference/contextualTyping21.errors.txt +++ b/tests/baselines/reference/contextualTyping21.errors.txt @@ -1,5 +1,5 @@ -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; }'. +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; }'. Type 'number' is not assignable to type '{ id: number; }'. Property 'id' is missing in type 'Number'. @@ -7,7 +7,7 @@ tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '(number | ==== tests/cases/compiler/contextualTyping21.ts (1 errors) ==== var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, 1]; ~~~ -!!! 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 '({ 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' is not assignable to type '{ id: number; }'. !!! error TS2322: Property 'id' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping30.errors.txt b/tests/baselines/reference/contextualTyping30.errors.txt index eda30769ac8..bce19c50896 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 '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type 'number'. +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'. 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 '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type '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: 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 26b06abf782..a1bfaf56336 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 '(number | Date)[]' is not assignable to type 'I'. +tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type '(Date | number)[]' is not assignable to type 'I'. Index signatures are incompatible. - Type 'number | Date' is not assignable to type 'Date'. + Type 'Date | number' is not assignable to type 'Date'. Type 'number' is not assignable to type 'Date'. Property 'toDateString' is missing in type 'Number'. @@ -12,9 +12,9 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ var x3: I = [new Date(), 1]; ~~ -!!! error TS2322: Type '(number | Date)[]' is not assignable to type 'I'. +!!! error TS2322: Type '(Date | number)[]' is not assignable to type 'I'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'number | Date' is not assignable to type 'Date'. +!!! error TS2322: Type 'Date | number' is not assignable to type 'Date'. !!! error TS2322: Type 'number' is not assignable to type 'Date'. !!! error TS2322: Property 'toDateString' is missing in type 'Number'. var r2 = x3[1]; diff --git a/tests/baselines/reference/declFileTypeAnnotationParenType.js b/tests/baselines/reference/declFileTypeAnnotationParenType.js index c61517c7339..126ec3a873e 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: string | (() => c); +declare var l: (() => c) | string; diff --git a/tests/baselines/reference/declFileTypeAnnotationParenType.types b/tests/baselines/reference/declFileTypeAnnotationParenType.types index 31b6ad03751..6776a0f492f 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 : string | (() => c) +>k : (() => c) | string >c : c ->(() => new c()) || "" : string | (() => c) +>(() => new c()) || "" : (() => c) | string >(() => 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 : string | (() => c) ->(() => new c()) || "" : string | (() => c) +>l : (() => c) | string +>(() => new c()) || "" : (() => c) | string >(() => new c()) : () => c >() => new c() : () => c >new c() : c diff --git a/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types b/tests/baselines/reference/declFileTypeAnnotationTypeAlias.types index beef88c0ca2..e93f86dbde7 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 : string | Window +>W : Window | string >Window : Window export module N { @@ -57,7 +57,7 @@ module M { >Window : Window export var p: W; ->p : string | Window ->W : string | Window +>p : Window | string +>W : Window | string } } diff --git a/tests/baselines/reference/declarationEmitDestructuring3.js b/tests/baselines/reference/declarationEmitDestructuring3.js index b21c63203c8..81cb1d96fd8 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]?: (string | number | boolean)[]): void; +declare function foo([x, ...y]?: (number | string | boolean)[]): void; diff --git a/tests/baselines/reference/declarationEmitDestructuring3.types b/tests/baselines/reference/declarationEmitDestructuring3.types index da9fc6d6606..737bb39e078 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]?: (string | number | boolean)[]) => void ->x : string | number | boolean ->y : (string | number | boolean)[] ->[1, "string", true] : (string | number | boolean)[] +>foo : ([x, ...y]?: (number | string | boolean)[]) => void +>x : number | string | boolean +>y : (number | string | boolean)[] +>[1, "string", true] : (number | string | boolean)[] >1 : number >"string" : string >true : boolean diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.js index 9a9be8c69da..28330d94f77 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: (string | number)[]; -declare var x2: string | number; -declare var x3: string | number, y3: string | number, z3: string | number; +declare var a: (number | string)[]; +declare var x2: number | string; +declare var x3: number | string, y3: number | string, z3: number | string; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern1.types index 0feeaf2db1a..9629324b9f9 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"] : (string | number)[] +>[1, "hello"] : (number | string)[] >1 : number >"hello" : string @@ -28,18 +28,18 @@ var [, , z1] = [0, 1, 2]; // emit z1: number >2 : number var a = [1, "hello"]; ->a : (string | number)[] ->[1, "hello"] : (string | number)[] +>a : (number | string)[] +>[1, "hello"] : (number | string)[] >1 : number >"hello" : string var [x2] = a; // emit x2: number | string ->x2 : string | number ->a : (string | number)[] +>x2 : number | string +>a : (number | string)[] var [x3, y3, z3] = a; // emit x3, y3, z3 ->x3 : string | number ->y3 : string | number ->z3 : string | number ->a : (string | number)[] +>x3 : number | string +>y3 : number | string +>z3 : number | string +>a : (number | string)[] diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.js index 818b3a6f7a9..662b4625ec8 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: (string | number)[], b3: { +declare var a3: (number | string)[], b3: { x: number; y: string; }; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types index 9fce72751cf..eb028aacff4 100644 --- a/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types +++ b/tests/baselines/reference/declarationEmitDestructuringArrayPattern2.types @@ -56,10 +56,10 @@ var [x13, y13] = [1, "hello"]; >"hello" : string var [a3, b3] = [[x13, y13], { x: x13, y: y13 }]; ->a3 : (string | number)[] +>a3 : (number | string)[] >b3 : { x: number; y: string; } ->[[x13, y13], { x: x13, y: y13 }] : [(string | number)[], { x: number; y: string; }] ->[x13, y13] : (string | number)[] +>[[x13, y13], { x: x13, y: y13 }] : [(number | string)[], { x: number; y: string; }] +>[x13, y13] : (number | string)[] >x13 : number >y13 : string >{ x: x13, y: y13 } : { x: number; y: string; } diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.js index 1bd07e7b974..d83c1b721d8 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: (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)[]; +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)[]; diff --git a/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types b/tests/baselines/reference/declarationEmitDestructuringArrayPattern4.types index 2cc56abcb05..1e8701eedb5 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 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>a9 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean var [x17, ...a10] = [1, "hello", true]; ->x17 : string | number | boolean ->a10 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>x17 : number | string | boolean +>a10 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean var [x18, y18, ...a12] = [1, "hello", true]; ->x18 : string | number | boolean ->y18 : string | number | boolean ->a12 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>x18 : number | string | boolean +>y18 : number | string | boolean +>a12 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean var [x19, y19, z19, ...a13] = [1, "hello", true]; ->x19 : string | number | boolean ->y19 : string | number | boolean ->z19 : string | number | boolean ->a13 : (string | number | boolean)[] ->[1, "hello", true] : (string | number | boolean)[] +>x19 : number | string | boolean +>y19 : number | string | boolean +>z19 : number | string | boolean +>a13 : (number | string | boolean)[] +>[1, "hello", true] : (number | string | boolean)[] >1 : number >"hello" : string >true : boolean diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types index bde9c867e2b..adff61e407c 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5.types @@ -148,8 +148,8 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; > : undefined > : undefined > : undefined ->c10 : (string | number)[] ->[1, 2, 3, 4, "hello"] : (string | number)[] +>c10 : (number | string)[] +>[1, 2, 3, 4, "hello"] : (number | string)[] >1 : number >2 : number >3 : number @@ -157,10 +157,10 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; >"hello" : string var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : string | number ->c12 : string | number ->c13 : (string | number)[] ->[1, 2, "string"] : (string | number)[] +>c11 : number | string +>c12 : number | string +>c13 : (number | string)[] +>[1, 2, "string"] : (number | string)[] >1 : number >2 : number >"string" : string diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types index 2d5d82c5efe..0a9e75a8aed 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES6.types @@ -149,8 +149,8 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; > : undefined > : undefined > : undefined ->c10 : (string | number)[] ->[1, 2, 3, 4, "hello"] : (string | number)[] +>c10 : (number | string)[] +>[1, 2, 3, 4, "hello"] : (number | string)[] >1 : number >2 : number >3 : number @@ -158,10 +158,10 @@ var [,,,...c10] = [1, 2, 3, 4, "hello"]; >"hello" : string var [c11, c12, ...c13] = [1, 2, "string"]; ->c11 : string | number ->c12 : string | number ->c13 : (string | number)[] ->[1, 2, "string"] : (string | number)[] +>c11 : number | string +>c12 : number | string +>c13 : (number | string)[] +>[1, 2, "string"] : (number | string)[] >1 : number >2 : number >"string" : string diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index 12f50d6886c..95524d4bf4d 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 '() => string | number | string[][]' is not assignable to type '() => number | string[][]'. - Type 'string | number | string[][]' is not assignable to type 'number | string[][]'. + Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'. + Type 'number | string[][] | string' is not assignable to type 'number | string[][]'. Type 'string' is not assignable to type 'number | string[][]'. Type 'string' is not assignable to type 'string[][]'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,8): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -26,10 +26,10 @@ 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: string | 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; }'. Types of property 'b' are incompatible. - Type 'boolean' is not assignable to type 'string | number'. - Type 'boolean' is not assignable to type 'number'. + Type 'boolean' is not assignable to type 'number | string'. + Type 'boolean' is not assignable to type 'string'. 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]]'. @@ -73,8 +73,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 '() => 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 '() => 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' is not assignable to type 'number | string[][]'. !!! error TS2345: Type 'string' is not assignable to type 'string[][]'. @@ -135,10 +135,10 @@ 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: string | number; }'. +!!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'. !!! error TS2345: Types of property 'b' are incompatible. -!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'. -!!! error TS2345: Type 'boolean' is not assignable to type 'number'. +!!! error TS2345: Type 'boolean' is not assignable to type 'number | string'. +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. 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 d51a0e32dc8..b8d48dcb9d4 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: (string | number)[]) => void ->x : (string | number)[] +>a1 : (...x: (number | string)[]) => void +>x : (number | string)[] function a2(...a) { } >a2 : (...a: any[]) => void @@ -75,8 +75,8 @@ var array = [1, 2, 3]; >3 : number var array2 = [true, false, "hello"]; ->array2 : (string | boolean)[] ->[true, false, "hello"] : (string | boolean)[] +>array2 : (boolean | string)[] +>[true, false, "hello"] : (boolean | string)[] >true : boolean >false : boolean >"hello" : string @@ -90,7 +90,7 @@ a2([...array]); a1(...array); >a1(...array) : void ->a1 : (...x: (string | number)[]) => void +>a1 : (...x: (number | string)[]) => 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 | boolean | string[][])[] +>[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[] >1 : number >2 : number >[["string"]] : string[][] diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.types b/tests/baselines/reference/destructuringParameterDeclaration3ES6.types index 63d5d074a8d..b439c4134ba 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: (string | number)[]) => void ->x : (string | number)[] +>a1 : (...x: (number | string)[]) => void +>x : (number | string)[] function a2(...a) { } >a2 : (...a: any[]) => void @@ -75,8 +75,8 @@ var array = [1, 2, 3]; >3 : number var array2 = [true, false, "hello"]; ->array2 : (string | boolean)[] ->[true, false, "hello"] : (string | boolean)[] +>array2 : (boolean | string)[] +>[true, false, "hello"] : (boolean | string)[] >true : boolean >false : boolean >"hello" : string @@ -90,7 +90,7 @@ a2([...array]); a1(...array); >a1(...array) : void ->a1 : (...x: (string | number)[]) => void +>a1 : (...x: (number | string)[]) => 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 | boolean | string[][])[] +>[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[] >1 : number >2 : number >[["string"]] : string[][] diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index 707fb005a80..7e71a2cd753 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(11,13): error TS2370: A rest parameter must be of an array type. 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(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. - Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. + Type 'boolean' is not assignable to type 'string'. 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. @@ -9,8 +9,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( Property '0' is missing in type 'String'. 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 '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type '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'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(29,24): error TS1005: ',' expected. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(34,22): error TS2304: Cannot find name 'E1'. @@ -43,8 +43,8 @@ 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 'string | number'. -!!! error TS2345: Type 'boolean' is not assignable to type 'number'. +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'. +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2304: Cannot find name 'array2'. @@ -60,8 +60,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 '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type '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: Type 'string' is not assignable to type 'number'. diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5.types b/tests/baselines/reference/destructuringVariableDeclaration1ES5.types index ef3507f0f8b..a0630fee995 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 : (string | number)[] ->[1,2,3, "string"] : (string | number)[] +>c2 : (number | string)[] +>[1,2,3, "string"] : (number | string)[] >1 : number >2 : number >3 : number @@ -113,9 +113,9 @@ var temp1 = [true, false, true] >true : boolean var [d3, d4] = [1, "string", ...temp1]; ->d3 : string | number | boolean ->d4 : string | number | boolean ->[1, "string", ...temp1] : (string | number | boolean)[] +>d3 : number | string | boolean +>d4 : number | string | boolean +>[1, "string", ...temp1] : (number | string | boolean)[] >1 : number >"string" : string >...temp1 : boolean diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES6.types b/tests/baselines/reference/destructuringVariableDeclaration1ES6.types index d62574c28f0..f9faf519b0a 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 : (string | number)[] ->[1,2,3, "string"] : (string | number)[] +>c2 : (number | string)[] +>[1,2,3, "string"] : (number | string)[] >1 : number >2 : number >3 : number @@ -113,9 +113,9 @@ var temp1 = [true, false, true] >true : boolean var [d3, d4] = [1, "string", ...temp1]; ->d3 : string | number | boolean ->d4 : string | number | boolean ->[1, "string", ...temp1] : (string | number | boolean)[] +>d3 : number | string | boolean +>d4 : number | string | boolean +>[1, "string", ...temp1] : (number | string | boolean)[] >1 : number >"string" : string >...temp1 : boolean diff --git a/tests/baselines/reference/enumBasics.types b/tests/baselines/reference/enumBasics.types index 6a147f01062..87f6f12b6b2 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 : (E3 | E4 | E7 | E8)[] ->[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E3 | E4 | E7 | E8)[] +>doNotPropagate : (E8 | E7 | E4 | E3)[] +>[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E8 | E7 | E4 | E3)[] 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 : (E5 | E6 | E9)[] ->[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E5 | E6 | E9)[] +>doPropagate : (E9 | E6 | E5)[] +>[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E9 | E6 | E5)[] 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/for-of11.errors.txt b/tests/baselines/reference/for-of11.errors.txt index dc527e73efe..7c00e454d4e 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 'string | number' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'number | string' 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 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | string' 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 f19fa5ed014..6100564ba58 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 'string | number' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'number | string' 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 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | string' 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 f2c1a607dd3..4facd65bda7 100644 --- a/tests/baselines/reference/functionImplementations.types +++ b/tests/baselines/reference/functionImplementations.types @@ -324,7 +324,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) => string | number +>x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => number | string >x : number if (x < 0) { return x; } diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types index f89034dbd83..06745d0d7aa 100644 --- a/tests/baselines/reference/generatedContextualTyping.types +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -2198,8 +2198,8 @@ var x222 = (>undefined) || [d1, d2]; >d2 : Derived2 var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; ->x223 : (Derived1 | Derived2)[] | { [n: number]: Base; } ->(<{ [n: number]: Base; }>undefined) || [d1, d2] : (Derived1 | Derived2)[] | { [n: number]: Base; } +>x223 : { [n: number]: Base; } | (Derived1 | Derived2)[] +>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; } | (Derived1 | Derived2)[] >(<{ [n: number]: Base; }>undefined) : { [n: number]: Base; } ><{ [n: number]: Base; }>undefined : { [n: number]: Base; } >n : number diff --git a/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types b/tests/baselines/reference/genericArgumentCallSigAssignmentCompat.types index c5fd984d327..5c7500fb5ed 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'] : (string | number | boolean)[] +>[true, 1, null, 'yes'] : (boolean | number | string)[] >true : boolean >1 : number >null : null diff --git a/tests/baselines/reference/genericCallWithArrayLiteralArgs.types b/tests/baselines/reference/genericCallWithArrayLiteralArgs.types index 48a7150ef44..c8e8b41b5fd 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 : (string | number)[] ->foo([1, '']) : (string | number)[] +>r4 : (number | string)[] +>foo([1, '']) : (number | string)[] >foo : (t: T) => T ->[1, ''] : (string | number)[] +>[1, ''] : (number | string)[] >1 : number >'' : string @@ -57,7 +57,7 @@ var r5 = foo([1, '']); // any[] >r5 : any[] >foo([1, '']) : any[] >foo : (t: T) => T ->[1, ''] : (string | number)[] +>[1, ''] : (number | string)[] >1 : number >'' : string @@ -66,7 +66,7 @@ var r6 = foo([1, '']); // Object[] >foo([1, '']) : Object[] >foo : (t: T) => T >Object : Object ->[1, ''] : (string | number)[] +>[1, ''] : (number | string)[] >1 : number >'' : string diff --git a/tests/baselines/reference/genericTypeArgumentInference1.types b/tests/baselines/reference/genericTypeArgumentInference1.types index 2d64c8f5c58..405c328bc45 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 : string | number | boolean ->_.all([true, 1, null, 'yes'], _.identity) : string | number | boolean +>r : boolean | number | string +>_.all([true, 1, null, 'yes'], _.identity) : boolean | number | string >_.all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T >_ : Underscore.Static >all : (list: T[], iterator?: Underscore.Iterator, context?: any) => T ->[true, 1, null, 'yes'] : (string | number | boolean)[] +>[true, 1, null, 'yes'] : (boolean | number | string)[] >true : boolean >1 : number >null : null diff --git a/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt b/tests/baselines/reference/heterogeneousArrayAndOverloads.errors.txt index e5c2be7a598..20e113faf2a 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 '(string | number)[]' is not assignable to parameter of type 'string[]'. - Type 'string | number' is not assignable to type 'string'. +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'. 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 '(string | number)[]' is not assignable to parameter of type 'string[]'. -!!! error TS2345: Type 'string | number' is not assignable to type 'string'. +!!! 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: 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 b453d7540c0..952200d74f8 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 : (string | number)[] ->[1, ''] : (string | number)[] +>a : (number | string)[] +>[1, ''] : (number | string)[] >1 : number >'' : string @@ -14,21 +14,21 @@ var b = [1, null]; // number[] >null : null var c = [1, '', null]; // {}[] ->c : (string | number)[] ->[1, '', null] : (string | number)[] +>c : (number | string)[] +>[1, '', null] : (number | string)[] >1 : number >'' : string >null : null var d = [{}, 1]; // {}[] ->d : (number | {})[] ->[{}, 1] : (number | {})[] +>d : ({} | number)[] +>[{}, 1] : ({} | number)[] >{} : {} >1 : number var e = [{}, Object]; // {}[] ->e : (ObjectConstructor | {})[] ->[{}, Object] : (ObjectConstructor | {})[] +>e : ({} | ObjectConstructor)[] +>[{}, Object] : ({} | ObjectConstructor)[] >{} : {} >Object : ObjectConstructor @@ -219,8 +219,8 @@ module Derived { >derived2 : Derived2 var p = [derived, derived2, base]; // Base[] ->p : (Base | Derived | Derived2)[] ->[derived, derived2, base] : (Base | Derived | Derived2)[] +>p : (Derived | Derived2 | Base)[] +>[derived, derived2, base] : (Derived | Derived2 | Base)[] >derived : Derived >derived2 : Derived2 >base : Base @@ -296,8 +296,8 @@ function foo(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -350,8 +350,8 @@ function foo2(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -374,26 +374,26 @@ function foo2(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : (Base | T)[] ->[t, base] : (Base | T)[] +>g : (T | Base)[] +>[t, base] : (T | Base)[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : (Derived | T)[] ->[t, derived] : (Derived | T)[] +>h : (T | Derived)[] +>[t, derived] : (T | Derived)[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : (Base | U)[] ->[u, base] : (Base | U)[] +>i : (U | Base)[] +>[u, base] : (U | Base)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : (Derived | U)[] ->[u, derived] : (Derived | U)[] +>j : (U | Derived)[] +>[u, derived] : (U | Derived)[] >u : U >derived : Derived } @@ -428,8 +428,8 @@ function foo3(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -452,26 +452,26 @@ function foo3(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : (Base | T)[] ->[t, base] : (Base | T)[] +>g : (T | Base)[] +>[t, base] : (T | Base)[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : (Derived | T)[] ->[t, derived] : (Derived | T)[] +>h : (T | Derived)[] +>[t, derived] : (T | Derived)[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : (Base | U)[] ->[u, base] : (Base | U)[] +>i : (U | Base)[] +>[u, base] : (U | Base)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : (Derived | U)[] ->[u, derived] : (Derived | U)[] +>j : (U | Derived)[] +>[u, derived] : (U | Derived)[] >u : U >derived : Derived } @@ -506,8 +506,8 @@ function foo4(t: T, u: U) { >u : U var d = [t, 1]; // {}[] ->d : (number | T)[] ->[t, 1] : (number | T)[] +>d : (T | number)[] +>[t, 1] : (T | number)[] >t : T >1 : number @@ -530,26 +530,26 @@ function foo4(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : (Base | T)[] ->[t, base] : (Base | T)[] +>g : (T | Base)[] +>[t, base] : (T | Base)[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : (Derived | T)[] ->[t, derived] : (Derived | T)[] +>h : (T | Derived)[] +>[t, derived] : (T | Derived)[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : (Base | U)[] ->[u, base] : (Base | U)[] +>i : (U | Base)[] +>[u, base] : (U | Base)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : (Derived | U)[] ->[u, derived] : (Derived | U)[] +>j : (U | Derived)[] +>[u, derived] : (U | Derived)[] >u : U >derived : Derived diff --git a/tests/baselines/reference/indexerWithTuple.types b/tests/baselines/reference/indexerWithTuple.types index 4faae2cda29..7605fba0518 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 : string | number ->unionTuple1[2] : string | number +>eleUnion12 : number | string +>unionTuple1[2] : number | string >unionTuple1 : [number, string | number] >2 : number var eleUnion13 = unionTuple1[idx0]; // string | number ->eleUnion13 : string | number ->unionTuple1[idx0] : string | number +>eleUnion13 : number | string +>unionTuple1[idx0] : number | string >unionTuple1 : [number, string | number] >idx0 : number var eleUnion14 = unionTuple1[idx1]; // string | number ->eleUnion14 : string | number ->unionTuple1[idx1] : string | number +>eleUnion14 : number | string +>unionTuple1[idx1] : number | string >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 : string | number | boolean ->unionTuple2[2] : string | number | boolean +>eleUnion22 : boolean | string | number +>unionTuple2[2] : boolean | string | number >unionTuple2 : [boolean, string | number] >2 : number var eleUnion23 = unionTuple2[idx0]; // string | number | boolean ->eleUnion23 : string | number | boolean ->unionTuple2[idx0] : string | number | boolean +>eleUnion23 : boolean | string | number +>unionTuple2[idx0] : boolean | string | number >unionTuple2 : [boolean, string | number] >idx0 : number var eleUnion24 = unionTuple2[idx1]; // string | number | boolean ->eleUnion24 : string | number | boolean ->unionTuple2[idx1] : string | number | boolean +>eleUnion24 : boolean | string | number +>unionTuple2[idx1] : boolean | string | number >unionTuple2 : [boolean, string | number] >idx1 : number diff --git a/tests/baselines/reference/inferentialTypingUsingApparentType3.types b/tests/baselines/reference/inferentialTypingUsingApparentType3.types index 7d0da8f4b06..9e0a4ceaea6 100644 --- a/tests/baselines/reference/inferentialTypingUsingApparentType3.types +++ b/tests/baselines/reference/inferentialTypingUsingApparentType3.types @@ -49,10 +49,10 @@ class ObjectField }> { } var person = new ObjectField({ ->person : ObjectField<{}, { [x: string]: CharField | NumberField; id: NumberField; name: CharField; }> ->new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { [x: string]: CharField | NumberField; id: NumberField; name: CharField; }> +>person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> +>new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> >ObjectField : typeof ObjectField ->{ id: new NumberField(), name: new CharField()} : { [x: string]: CharField | NumberField; id: NumberField; name: CharField; } +>{ id: new NumberField(), name: new CharField()} : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } id: new NumberField(), >id : NumberField @@ -68,8 +68,8 @@ var person = new ObjectField({ person.fields.id; >person.fields.id : NumberField ->person.fields : { [x: string]: CharField | NumberField; id: NumberField; name: CharField; } ->person : ObjectField<{}, { [x: string]: CharField | NumberField; id: NumberField; name: CharField; }> ->fields : { [x: string]: CharField | NumberField; id: NumberField; name: CharField; } +>person.fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } +>person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }> +>fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; } >id : NumberField diff --git a/tests/baselines/reference/iteratorSpreadInCall12.types b/tests/baselines/reference/iteratorSpreadInCall12.types index fcc4bbc3d45..4307daa78b0 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]] : string | symbol ->[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[] +>...[...new SymbolIterator, ...[...new StringIterator]] : symbol | string +>[...new SymbolIterator, ...[...new StringIterator]] : (symbol | string)[] >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator >SymbolIterator : typeof SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInCall5.types b/tests/baselines/reference/iteratorSpreadInCall5.types index 2401a41cca8..631ad940554 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: (string | symbol)[]) => void +>foo : (...s: (symbol | string)[]) => 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: (string | symbol)[]) => void ->s : (string | symbol)[] +>foo : (...s: (symbol | string)[]) => void +>s : (symbol | string)[] class SymbolIterator { >SymbolIterator : SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt index be085beb632..0a0da985ace 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. - Type 'string' is not assignable to type 'symbol'. +tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. + Type 'string' is not assignable to type 'number'. ==== 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 'number | symbol'. -!!! error TS2345: Type 'string' is not assignable to type 'symbol'. +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. function foo(...s: (symbol | number)[]) { } class SymbolIterator { diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index 5f6369cbf8c..04bc188e308 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -121,26 +121,26 @@ var rb4 = a4 || a2; // string || boolean is string | boolean >a2 : boolean var rb5 = a5 || a2; // void || boolean is void | boolean ->rb5 : boolean | void ->a5 || a2 : boolean | void +>rb5 : void | boolean +>a5 || a2 : void | boolean >a5 : void >a2 : boolean var rb6 = a6 || a2; // enum || boolean is E | boolean ->rb6 : boolean | E ->a6 || a2 : boolean | E +>rb6 : E | boolean +>a6 || a2 : E | boolean >a6 : E >a2 : boolean var rb7 = a7 || a2; // object || boolean is object | boolean ->rb7 : boolean | { a: string; } ->a7 || a2 : boolean | { a: string; } +>rb7 : { a: string; } | boolean +>a7 || a2 : { a: string; } | boolean >a7 : { a: string; } >a2 : boolean var rb8 = a8 || a2; // array || boolean is array | boolean ->rb8 : boolean | string[] ->a8 || a2 : boolean | string[] +>rb8 : string[] | boolean +>a8 || a2 : string[] | boolean >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 : number | boolean ->a2 || a3 : number | boolean +>rc2 : boolean | number +>a2 || a3 : boolean | number >a2 : boolean >a3 : number @@ -181,26 +181,26 @@ var rc4 = a4 || a3; // string || number is string | number >a3 : number var rc5 = a5 || a3; // void || number is void | number ->rc5 : number | void ->a5 || a3 : number | void +>rc5 : void | number +>a5 || a3 : void | number >a5 : void >a3 : number var rc6 = a6 || a3; // enum || number is number ->rc6 : number | E ->a6 || a3 : number | E +>rc6 : E | number +>a6 || a3 : E | number >a6 : E >a3 : number var rc7 = a7 || a3; // object || number is object | number ->rc7 : number | { a: string; } ->a7 || a3 : number | { a: string; } +>rc7 : { a: string; } | number +>a7 || a3 : { a: string; } | number >a7 : { a: string; } >a3 : number var rc8 = a8 || a3; // array || number is array | number ->rc8 : number | string[] ->a8 || a3 : number | string[] +>rc8 : string[] | number +>a8 || a3 : string[] | number >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 : string | boolean ->a2 || a4 : string | boolean +>rd2 : boolean | string +>a2 || a4 : boolean | string >a2 : boolean >a4 : string var rd3 = a3 || a4; // number || string is number | string ->rd3 : string | number ->a3 || a4 : string | number +>rd3 : number | string +>a3 || a4 : number | string >a3 : number >a4 : string @@ -241,26 +241,26 @@ var rd4 = a4 || a4; // string || string is string >a4 : string var rd5 = a5 || a4; // void || string is void | string ->rd5 : string | void ->a5 || a4 : string | void +>rd5 : void | string +>a5 || a4 : void | string >a5 : void >a4 : string var rd6 = a6 || a4; // enum || string is enum | string ->rd6 : string | E ->a6 || a4 : string | E +>rd6 : E | string +>a6 || a4 : E | string >a6 : E >a4 : string var rd7 = a7 || a4; // object || string is object | string ->rd7 : string | { a: string; } ->a7 || a4 : string | { a: string; } +>rd7 : { a: string; } | string +>a7 || a4 : { a: string; } | 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 : void | E ->a6 || a5 : void | E +>re6 : E | void +>a6 || a5 : E | void >a6 : E >a5 : void var re7 = a7 || a5; // object || void is object | void ->re7 : void | { a: string; } ->a7 || a5 : void | { a: string; } +>re7 : { a: string; } | void +>a7 || a5 : { a: string; } | void >a7 : { a: string; } >a5 : void var re8 = a8 || a5; // array || void is array | void ->re8 : void | string[] ->a8 || a5 : void | string[] +>re8 : string[] | void +>a8 || a5 : string[] | void >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 : E | { a: string; } ->a7 || a6 : E | { a: string; } +>rg7 : { a: string; } | E +>a7 || a6 : { a: string; } | E >a7 : { a: string; } >a6 : E var rg8 = a8 || a6; // array || enum is array | enum ->rg8 : E | string[] ->a8 || a6 : E | string[] +>rg8 : string[] | E +>a8 || a6 : string[] | E >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 : { a: string; } | string[] ->a8 || a7 : { a: string; } | string[] +>rh8 : string[] | { a: string; } +>a8 || a7 : string[] | { a: string; } >a8 : string[] >a7 : { a: string; } diff --git a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt index 3711a386bf9..7445ab85a54 100644 --- a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt +++ b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(7,30): error TS2349: Cannot invoke an expression whose type lacks a call signature. -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'. +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'. 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. @@ -19,8 +19,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 '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type '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: 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 b98b1e4d234..e6a3466b88f 100644 --- a/tests/baselines/reference/narrowTypeByInstanceof.types +++ b/tests/baselines/reference/narrowTypeByInstanceof.types @@ -22,24 +22,24 @@ } type FileMatchOrMatch = FileMatch | Match; ->FileMatchOrMatch : Match | FileMatch +>FileMatchOrMatch : FileMatch | Match >FileMatch : FileMatch >Match : Match let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch; ->elementA : Match | FileMatch ->FileMatchOrMatch : Match | FileMatch ->elementB : Match | FileMatch ->FileMatchOrMatch : Match | FileMatch +>elementA : FileMatch | Match +>FileMatchOrMatch : FileMatch | Match +>elementB : FileMatch | Match +>FileMatchOrMatch : FileMatch | Match if (elementA instanceof FileMatch && elementB instanceof FileMatch) { >elementA instanceof FileMatch && elementB instanceof FileMatch : boolean >elementA instanceof FileMatch : boolean ->elementA : Match | FileMatch +>elementA : FileMatch | Match >FileMatch : typeof FileMatch >elementB instanceof FileMatch : boolean ->elementB : Match | FileMatch +>elementB : FileMatch | Match >FileMatch : typeof FileMatch let a = elementA.resource().path; @@ -63,10 +63,10 @@ if (elementA instanceof FileMatch && elementB instanceof FileMatch) { } else if (elementA instanceof Match && elementB instanceof Match) { >elementA instanceof Match && elementB instanceof Match : boolean >elementA instanceof Match : boolean ->elementA : Match | FileMatch +>elementA : FileMatch | Match >Match : typeof Match >elementB instanceof Match : boolean ->elementB : Match | FileMatch +>elementB : FileMatch | Match >Match : typeof Match let a = elementA.range(); diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index da9184661b3..71e164d5d62 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: number | A | B; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. Index signatures are incompatible. - Type 'number | A | B' is not assignable to type 'A'. + Type 'A | B | number' is not assignable to type 'A'. Type 'number' is not assignable to type 'A'. @@ -54,9 +54,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo // error var b: { [x: number]: A } = { ~ -!!! error TS2322: Type '{ [x: number]: number | A | B; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +!!! error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'number | A | B' is not assignable to type 'A'. +!!! error TS2322: Type 'A | B | number' is not assignable to type 'A'. !!! error TS2322: Type 'number' is not assignable to type 'A'. 1.0: new A(), 2.0: new B(), diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index 09d35cfd493..edb6d031b1f 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A | B; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. Index signatures are incompatible. Type 'A' is not assignable to type 'B'. @@ -18,7 +18,7 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A ~~ -!!! error TS2322: Type '{ [x: string]: A | B; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'A' is not assignable to type 'B'. o1 = { x: c, 0: a }; // string indexer is any, number indexer is A \ No newline at end of file diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index c8875d99b63..e6cba35be25 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -22,9 +22,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | MyString | (() => void) | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. Index signatures are incompatible. - Type 'string | number | MyString | (() => void) | (() => string)' is not assignable to type 'string'. + Type 'string | number | (() => void) | MyString | (() => string)' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -160,9 +160,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: string; } = { ~ -!!! error TS2322: Type '{ [x: string]: string | number | MyString | (() => void) | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +!!! error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString | (() => string); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'string | number | MyString | (() => void) | (() => string)' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number | (() => void) | MyString | (() => string)' is not assignable to type 'string'. !!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, diff --git a/tests/baselines/reference/subtypesOfUnion.errors.txt b/tests/baselines/reference/subtypesOfUnion.errors.txt index fade5377814..7c2e88ec8fd 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 '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(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 (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 'number | E'. +!!! error TS2411: Property 'foo2' of type 'string' is not assignable to string index type 'E | number'. foo3: number; // ok foo4: boolean; // error ~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo4' of type 'boolean' is not assignable to string index type 'E | number'. foo5: E; // ok foo6: Date; // error ~~~~~~~~~~~ -!!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo6' of type 'Date' is not assignable to string index type 'E | number'. foo7: RegExp; // error ~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo7' of type 'RegExp' is not assignable to string index type 'E | number'. foo8: { bar: number }; // error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo8' of type '{ bar: number; }' is not assignable to string index type 'E | number'. foo9: I8; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo9' of type 'I8' is not assignable to string index type 'E | number'. foo10: A; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo10' of type 'A' is not assignable to string index type 'E | number'. foo11: A2; // error ~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo11' of type 'A2' is not assignable to string index type 'E | number'. foo12: (x) => number; //error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo12' of type '(x: any) => number' is not assignable to string index type 'E | number'. foo13: (x: T) => T; // error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo13' of type '(x: T) => T' is not assignable to string index type 'E | number'. foo14: typeof f; // error ~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo14' of type 'typeof f' is not assignable to string index type 'E | number'. foo15: typeof c; // error ~~~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo15' of type 'typeof c' is not assignable to string index type 'E | number'. foo16: T; // error ~~~~~~~~~ -!!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo16' of type 'T' is not assignable to string index type 'E | number'. foo17: Object; // error ~~~~~~~~~~~~~~ -!!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo17' of type 'Object' is not assignable to string index type 'E | number'. foo18: {}; // error ~~~~~~~~~~ -!!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'number | E'. +!!! error TS2411: Property 'foo18' of type '{}' is not assignable to string index type 'E | number'. } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.types b/tests/baselines/reference/subtypingWithCallSignatures2.types index ce7918c7627..e43382766ac 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.types +++ b/tests/baselines/reference/subtypingWithCallSignatures2.types @@ -331,8 +331,8 @@ var r1 = foo1(r1arg1); // any, return types are not subtype of first overload >r1arg1 : (x: T) => T[] var r1a = [r1arg2, r1arg1]; // generic signature, subtype in both directions ->r1a : (((x: T) => T[]) | ((x: number) => number[]))[] ->[r1arg2, r1arg1] : (((x: T) => T[]) | ((x: number) => number[]))[] +>r1a : (((x: number) => number[]) | ((x: T) => T[]))[] +>[r1arg2, r1arg1] : (((x: number) => number[]) | ((x: T) => T[]))[] >r1arg2 : (x: number) => number[] >r1arg1 : (x: T) => T[] @@ -371,8 +371,8 @@ var r2a = [r2arg1, r2arg2]; >r2arg2 : (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : (((x: T) => string[]) | ((x: number) => string[]))[] ->[r2arg2, r2arg1] : (((x: T) => string[]) | ((x: number) => string[]))[] +>r2b : (((x: number) => string[]) | ((x: T) => string[]))[] +>[r2arg2, r2arg1] : (((x: number) => string[]) | ((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: T) => T) | ((x: number) => void))[] ->[r3arg2, r3arg1] : (((x: T) => T) | ((x: number) => void))[] +>r3b : (((x: number) => void) | ((x: T) => T))[] +>[r3arg2, r3arg1] : (((x: number) => void) | ((x: T) => T))[] >r3arg2 : (x: number) => void >r3arg1 : (x: T) => T @@ -438,8 +438,8 @@ var r4a = [r4arg1, r4arg2]; >r4arg2 : (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] ->[r4arg2, r4arg1] : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] +>r4b : (((x: string, y: number) => string) | ((x: T, y: U) => T))[] +>[r4arg2, r4arg1] : (((x: string, y: number) => string) | ((x: T, y: U) => T))[] >r4arg2 : (x: string, y: number) => string >r4arg1 : (x: T, y: U) => T @@ -476,8 +476,8 @@ var r5a = [r5arg1, r5arg2]; >r5arg2 : (x: (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] ->[r5arg2, r5arg1] : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] +>r5b : (((x: (arg: string) => number) => string) | ((x: (arg: T) => U) => T))[] +>[r5arg2, r5arg1] : (((x: (arg: string) => number) => string) | ((x: (arg: T) => U) => T))[] >r5arg2 : (x: (arg: string) => number) => string >r5arg1 : (x: (arg: T) => U) => T @@ -520,8 +520,8 @@ var r6a = [r6arg1, r6arg2]; >r6arg2 : (x: (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] ->[r6arg2, r6arg1] : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] +>r6b : (((x: (arg: Base) => Derived) => Base) | ((x: (arg: T) => U) => T))[] +>[r6arg2, r6arg1] : (((x: (arg: Base) => Derived) => Base) | ((x: (arg: T) => U) => T))[] >r6arg2 : (x: (arg: Base) => Derived) => Base >r6arg1 : (x: (arg: T) => U) => T @@ -570,8 +570,8 @@ var r7a = [r7arg1, r7arg2]; >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived var r7b = [r7arg2, r7arg1]; ->r7b : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] ->[r7arg2, r7arg1] : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] +>r7b : (((x: (arg: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U) => (r: T) => U))[] +>[r7arg2, r7arg1] : (((x: (arg: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U) => (r: T) => U))[] >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived >r7arg1 : (x: (arg: T) => U) => (r: T) => U @@ -628,8 +628,8 @@ var r8a = [r8arg1, r8arg2]; >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived var r8b = [r8arg2, r8arg1]; ->r8b : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] ->[r8arg2, r8arg1] : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>r8b : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U))[] +>[r8arg2, r8arg1] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U))[] >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U @@ -687,8 +687,8 @@ var r9a = [r9arg1, r9arg2]; >r9arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived var r9b = [r9arg2, r9arg1]; ->r9b : (((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] ->[r9arg2, r9arg1] : (((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>r9b : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U))[] +>[r9arg2, r9arg1] : (((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived) | ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U))[] >r9arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U @@ -725,8 +725,8 @@ var r10a = [r10arg1, r10arg2]; >r10arg2 : (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] ->[r10arg2, r10arg1] : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] +>r10b : (((...x: Derived[]) => Derived) | ((...x: T[]) => T))[] +>[r10arg2, r10arg1] : (((...x: Derived[]) => Derived) | ((...x: T[]) => T))[] >r10arg2 : (...x: Derived[]) => Derived >r10arg1 : (...x: T[]) => T @@ -766,8 +766,8 @@ var r11a = [r11arg1, r11arg2]; >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r11arg2, r11arg1] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r11b : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] +>[r11arg2, r11arg1] : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : (x: T, y: T) => T @@ -814,8 +814,8 @@ var r12a = [r12arg1, r12arg2]; >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] ->[r12arg2, r12arg1] : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>r12b : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: T) => Derived[]))[] +>[r12arg2, r12arg1] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: T) => Derived[]))[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : (x: Base[], y: T) => Derived[] @@ -859,8 +859,8 @@ var r13a = [r13arg1, r13arg2]; >r13arg2 : (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] ->[r13arg2, r13arg1] : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] +>r13b : (((x: Base[], y: Derived[]) => Derived[]) | ((x: Base[], y: T) => T))[] +>[r13arg2, r13arg1] : (((x: Base[], y: Derived[]) => Derived[]) | ((x: Base[], y: T) => T))[] >r13arg2 : (x: Base[], y: Derived[]) => Derived[] >r13arg1 : (x: Base[], y: T) => T @@ -900,8 +900,8 @@ var r14a = [r14arg1, r14arg2]; >r14arg2 : (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] ->[r14arg2, r14arg1] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] +>r14b : (((x: { a: string; b: number; }) => Object) | ((x: { a: T; b: T; }) => T))[] +>[r14arg2, r14arg1] : (((x: { a: string; b: number; }) => Object) | ((x: { a: T; b: T; }) => T))[] >r14arg2 : (x: { a: string; b: number; }) => Object >r14arg1 : (x: { a: T; b: T; }) => T diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.types b/tests/baselines/reference/subtypingWithCallSignatures3.types index a78d68b1ced..0d3a84ac99c 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -291,8 +291,8 @@ module Errors { >r2arg : (x: (arg: T) => U) => (r: T) => V var r2a = [r2arg2, r2arg]; ->r2a : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] ->[r2arg2, r2arg] : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] +>r2a : (((x: (arg: Base) => Derived) => (r: Base) => Derived2) | ((x: (arg: T) => U) => (r: T) => V))[] +>[r2arg2, r2arg] : (((x: (arg: Base) => Derived) => (r: Base) => Derived2) | ((x: (arg: T) => U) => (r: T) => V))[] >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 >r2arg : (x: (arg: T) => U) => (r: T) => V @@ -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: 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))[] +>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))[] >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 @@ -387,8 +387,8 @@ module Errors { >r4arg : (...x: T[]) => T var r4a = [r4arg2, r4arg]; ->r4a : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] ->[r4arg2, r4arg] : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] +>r4a : (((...x: Base[]) => Base) | ((...x: T[]) => T))[] +>[r4arg2, r4arg] : (((...x: Base[]) => Base) | ((...x: T[]) => T))[] >r4arg2 : (...x: Base[]) => Base >r4arg : (...x: T[]) => T @@ -430,8 +430,8 @@ module Errors { >r5arg : (x: T, y: T) => T var r5a = [r5arg2, r5arg]; ->r5a : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r5arg2, r5arg] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r5a : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] +>[r5arg2, r5arg] : (((x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | ((x: T, y: T) => T))[] >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg : (x: T, y: T) => T @@ -478,8 +478,8 @@ module Errors { >r6arg : (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg]; ->r6a : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] ->[r6arg2, r6arg] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] +>r6a : (((x: Base[], y: Base[]) => T) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>[r6arg2, r6arg] : (((x: Base[], y: Base[]) => T) | ((x: Base[], y: Derived2[]) => Derived[]))[] >r6arg2 : (x: Base[], y: Base[]) => T >r6arg : (x: Base[], y: Derived2[]) => Derived[] @@ -517,8 +517,8 @@ module Errors { >r7arg : (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg]; ->r7a : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] ->[r7arg2, r7arg] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] +>r7a : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => T))[] +>[r7arg2, r7arg] : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => T))[] >r7arg2 : (x: { a: string; b: number; }) => number >r7arg : (x: { a: T; b: T; }) => T @@ -553,8 +553,8 @@ module Errors { >r7arg3 : (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] ->[r7arg3, r7arg2] : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] +>r7e : (((x: { a: T; b: T; }) => number) | ((x: { a: string; b: number; }) => number))[] +>[r7arg3, r7arg2] : (((x: { a: T; b: T; }) => number) | ((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 1ba6348acd2..830f065f556 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) => T) | ((x: T) => void))[] ->[r3arg2, r3arg] : (((x: T) => T) | ((x: T) => void))[] +>r3b : (((x: T) => void) | ((x: T) => T))[] +>[r3arg2, r3arg] : (((x: T) => void) | ((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) => U) => T) | ((x: (arg: T) => Derived) => T))[] ->[r6arg2, r6arg] : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] +>r6b : (((x: (arg: T) => Derived) => T) | ((x: (arg: T) => U) => T))[] +>[r6arg2, r6arg] : (((x: (arg: T) => Derived) => T) | ((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: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] ->[r11arg2, r11arg] : (((x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>r11b : (((x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] +>[r11arg2, r11arg] : (((x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | ((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: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] ->[r15arg2, r15arg] : (((x: { a: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] +>r15b : (((x: { a: T; b: T; }) => T[]) | ((x: { a: U; b: V; }) => U[]))[] +>[r15arg2, r15arg] : (((x: { a: T; b: T; }) => T[]) | ((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 e8ff518215f..f00ad0332ca 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.types @@ -326,8 +326,8 @@ var r1 = foo1(r1arg1); // any, return types are not subtype of first overload >r1arg1 : new (x: T) => T[] var r1a = [r1arg2, r1arg1]; // generic signature, subtype in both directions ->r1a : ((new (x: T) => T[]) | (new (x: number) => number[]))[] ->[r1arg2, r1arg1] : ((new (x: T) => T[]) | (new (x: number) => number[]))[] +>r1a : ((new (x: number) => number[]) | (new (x: T) => T[]))[] +>[r1arg2, r1arg1] : ((new (x: number) => number[]) | (new (x: T) => T[]))[] >r1arg2 : new (x: number) => number[] >r1arg1 : new (x: T) => T[] @@ -360,8 +360,8 @@ var r2a = [r2arg1, r2arg2]; >r2arg2 : new (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : ((new (x: T) => string[]) | (new (x: number) => string[]))[] ->[r2arg2, r2arg1] : ((new (x: T) => string[]) | (new (x: number) => string[]))[] +>r2b : ((new (x: number) => string[]) | (new (x: T) => string[]))[] +>[r2arg2, r2arg1] : ((new (x: number) => string[]) | (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: T) => T) | (new (x: number) => void))[] ->[r3arg2, r3arg1] : ((new (x: T) => T) | (new (x: number) => void))[] +>r3b : ((new (x: number) => void) | (new (x: T) => T))[] +>[r3arg2, r3arg1] : ((new (x: number) => void) | (new (x: T) => T))[] >r3arg2 : new (x: number) => void >r3arg1 : new (x: T) => T @@ -422,8 +422,8 @@ var r4a = [r4arg1, r4arg2]; >r4arg2 : new (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] ->[r4arg2, r4arg1] : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] +>r4b : ((new (x: string, y: number) => string) | (new (x: T, y: U) => T))[] +>[r4arg2, r4arg1] : ((new (x: string, y: number) => string) | (new (x: T, y: U) => T))[] >r4arg2 : new (x: string, y: number) => string >r4arg1 : new (x: T, y: U) => T @@ -455,8 +455,8 @@ var r5a = [r5arg1, r5arg2]; >r5arg2 : new (x: new (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] ->[r5arg2, r5arg1] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] +>r5b : ((new (x: new (arg: string) => number) => string) | (new (x: new (arg: T) => U) => T))[] +>[r5arg2, r5arg1] : ((new (x: new (arg: string) => number) => string) | (new (x: new (arg: T) => U) => T))[] >r5arg2 : new (x: new (arg: string) => number) => string >r5arg1 : new (x: new (arg: T) => U) => T @@ -493,8 +493,8 @@ var r6a = [r6arg1, r6arg2]; >r6arg2 : new (x: new (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] ->[r6arg2, r6arg1] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] +>r6b : ((new (x: new (arg: Base) => Derived) => Base) | (new (x: new (arg: T) => U) => T))[] +>[r6arg2, r6arg1] : ((new (x: new (arg: Base) => Derived) => Base) | (new (x: new (arg: T) => U) => T))[] >r6arg2 : new (x: new (arg: Base) => Derived) => Base >r6arg1 : new (x: new (arg: T) => U) => T @@ -535,8 +535,8 @@ var r7a = [r7arg1, r7arg2]; >r7arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived var r7b = [r7arg2, r7arg1]; ->r7b : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] ->[r7arg2, r7arg1] : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] +>r7b : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U) => new (r: T) => U))[] +>[r7arg2, r7arg1] : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U) => new (r: T) => U))[] >r7arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U @@ -585,8 +585,8 @@ var r8a = [r8arg1, r8arg2]; >r8arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived var r8b = [r8arg2, r8arg1]; ->r8b : ((new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] ->[r8arg2, r8arg1] : ((new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived))[] +>r8b : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U))[] +>[r8arg2, r8arg1] : ((new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived) | (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U))[] >r8arg2 : new (x: new (arg: Base) => Derived, y: new (arg2: Base) => Derived) => new (r: Base) => Derived >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U @@ -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: 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))[] +>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))[] >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 @@ -668,8 +668,8 @@ var r10a = [r10arg1, r10arg2]; >r10arg2 : new (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] ->[r10arg2, r10arg1] : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] +>r10b : ((new (...x: Derived[]) => Derived) | (new (...x: T[]) => T))[] +>[r10arg2, r10arg1] : ((new (...x: Derived[]) => Derived) | (new (...x: T[]) => T))[] >r10arg2 : new (...x: Derived[]) => Derived >r10arg1 : new (...x: T[]) => T @@ -705,8 +705,8 @@ var r11a = [r11arg1, r11arg2]; >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r11arg2, r11arg1] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r11b : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] +>[r11arg2, r11arg1] : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : new (x: T, y: T) => T @@ -747,8 +747,8 @@ var r12a = [r12arg1, r12arg2]; >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] ->[r12arg2, r12arg1] : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] +>r12b : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: T) => Derived[]))[] +>[r12arg2, r12arg1] : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: T) => Derived[]))[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : new (x: Base[], y: T) => Derived[] @@ -788,8 +788,8 @@ var r13a = [r13arg1, r13arg2]; >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] ->[r13arg2, r13arg1] : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] +>r13b : ((new (x: Base[], y: Derived[]) => Derived[]) | (new (x: Base[], y: T) => T))[] +>[r13arg2, r13arg1] : ((new (x: Base[], y: Derived[]) => Derived[]) | (new (x: Base[], y: T) => T))[] >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] >r13arg1 : new (x: Base[], y: T) => T @@ -823,8 +823,8 @@ var r14a = [r14arg1, r14arg2]; >r14arg2 : new (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] ->[r14arg2, r14arg1] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] +>r14b : ((new (x: { a: string; b: number; }) => Object) | (new (x: { a: T; b: T; }) => T))[] +>[r14arg2, r14arg1] : ((new (x: { a: string; b: number; }) => Object) | (new (x: { a: T; b: T; }) => T))[] >r14arg2 : new (x: { a: string; b: number; }) => Object >r14arg1 : new (x: { a: T; b: T; }) => T diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.types b/tests/baselines/reference/subtypingWithConstructSignatures3.types index 63b1e64e541..b7c90d8697e 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.types @@ -224,8 +224,8 @@ module Errors { >r1arg1 : new (x: T) => U[] var r1a = [r1arg2, r1arg1]; ->r1a : ((new (x: T) => U[]) | (new (x: number) => string[]))[] ->[r1arg2, r1arg1] : ((new (x: T) => U[]) | (new (x: number) => string[]))[] +>r1a : ((new (x: number) => string[]) | (new (x: T) => U[]))[] +>[r1arg2, r1arg1] : ((new (x: number) => string[]) | (new (x: T) => U[]))[] >r1arg2 : new (x: number) => string[] >r1arg1 : new (x: T) => U[] @@ -268,8 +268,8 @@ module Errors { >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V var r2a = [r2arg2, r2arg1]; ->r2a : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] ->[r2arg2, r2arg1] : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] +>r2a : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2) | (new (x: new (arg: T) => U) => new (r: T) => V))[] +>[r2arg2, r2arg1] : ((new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2) | (new (x: new (arg: T) => U) => new (r: T) => V))[] >r2arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V @@ -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: 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))[] +>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))[] >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 @@ -350,8 +350,8 @@ module Errors { >r4arg1 : new (...x: T[]) => T var r4a = [r4arg2, r4arg1]; ->r4a : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] ->[r4arg2, r4arg1] : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] +>r4a : ((new (...x: Base[]) => Base) | (new (...x: T[]) => T))[] +>[r4arg2, r4arg1] : ((new (...x: Base[]) => Base) | (new (...x: T[]) => T))[] >r4arg2 : new (...x: Base[]) => Base >r4arg1 : new (...x: T[]) => T @@ -387,8 +387,8 @@ module Errors { >r5arg1 : new (x: T, y: T) => T var r5a = [r5arg2, r5arg1]; ->r5a : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] ->[r5arg2, r5arg1] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>r5a : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] +>[r5arg2, r5arg1] : ((new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base) | (new (x: T, y: T) => T))[] >r5arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg1 : new (x: T, y: T) => T @@ -429,8 +429,8 @@ module Errors { >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg1]; ->r6a : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] ->[r6arg2, r6arg1] : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] +>r6a : ((new (x: Base[], y: Base[]) => T) | (new (x: Base[], y: Derived2[]) => Derived[]))[] +>[r6arg2, r6arg1] : ((new (x: Base[], y: Base[]) => T) | (new (x: Base[], y: Derived2[]) => Derived[]))[] >r6arg2 : new (x: Base[], y: Base[]) => T >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] @@ -463,8 +463,8 @@ module Errors { >r7arg1 : new (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg1]; ->r7a : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] ->[r7arg2, r7arg1] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] +>r7a : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => T))[] +>[r7arg2, r7arg1] : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => T))[] >r7arg2 : new (x: { a: string; b: number; }) => number >r7arg1 : new (x: { a: T; b: T; }) => T @@ -497,8 +497,8 @@ module Errors { >r7arg3 : new (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] ->[r7arg3, r7arg2] : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] +>r7e : ((new (x: { a: T; b: T; }) => number) | (new (x: { a: string; b: number; }) => number))[] +>[r7arg3, r7arg2] : ((new (x: { a: T; b: T; }) => number) | (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 bfe07d3b12b..328dadad41c 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) => T) | (new (x: T) => void))[] ->[r3arg2, r3arg] : ((new (x: T) => T) | (new (x: T) => void))[] +>r3b : ((new (x: T) => void) | (new (x: T) => T))[] +>[r3arg2, r3arg] : ((new (x: T) => void) | (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) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] ->[r6arg2, r6arg] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] +>r6b : ((new (x: new (arg: T) => Derived) => T) | (new (x: new (arg: T) => U) => T))[] +>[r6arg2, r6arg] : ((new (x: new (arg: T) => Derived) => T) | (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: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] ->[r11arg2, r11arg] : ((new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>r11b : ((new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base))[] +>[r11arg2, r11arg] : ((new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base) | (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: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] ->[r15arg2, r15arg] : ((new (x: { a: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] +>r15b : ((new (x: { a: T; b: T; }) => T[]) | (new (x: { a: U; b: V; }) => U[]))[] +>[r15arg2, r15arg] : ((new (x: { a: T; b: T; }) => T[]) | (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 6ab1349713c..a7de59a11b7 100644 --- a/tests/baselines/reference/symbolType11.types +++ b/tests/baselines/reference/symbolType11.types @@ -28,12 +28,12 @@ s || s; >s : symbol s || 1; ->s || 1 : number | symbol +>s || 1 : symbol | number >s : symbol >1 : number ({}) || s; ->({}) || s : symbol | {} +>({}) || s : {} | symbol >({}) : {} >{} : {} >s : symbol diff --git a/tests/baselines/reference/targetTypeTest2.types b/tests/baselines/reference/targetTypeTest2.types index 25b36f948c6..53381b9de43 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"] : (string | number)[] +>[1,2,"3"] : (number | string)[] >1 : number >2 : number >"3" : string diff --git a/tests/baselines/reference/targetTypeTest3.errors.txt b/tests/baselines/reference/targetTypeTest3.errors.txt index f5dab732ed3..935a9b9e68e 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 '(string | number)[]' is not assignable to type 'string[]'. - Type 'string | number' is not assignable to type 'string'. +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'. Type 'number' is not assignable to type 'string'. @@ -9,8 +9,8 @@ tests/cases/compiler/targetTypeTest3.ts(4,5): error TS2322: Type '(string | numb var a : string[] = [1,2,"3"]; // should produce an error ~ -!!! 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 | string)[]' is not assignable to type 'string[]'. +!!! error TS2322: Type 'number | string' 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 04cc09a1005..aec30c02e00 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 : (string | number)[] ->[1, 2, `abc${ 123 }def`] : (string | number)[] +>x : (number | string)[] +>[1, 2, `abc${ 123 }def`] : (number | string)[] >1 : number >2 : number >`abc${ 123 }def` : string diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditional.types b/tests/baselines/reference/templateStringWithEmbeddedConditional.types index 7ec1ef97a30..2a741dc271b 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 : " " : string | boolean +>true ? false : " " : boolean | string >true : boolean >false : boolean >" " : string diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types b/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types index 5453880ce16..d0a228ee673 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 : " " : string | boolean +>true ? false : " " : boolean | string >true : boolean >false : boolean >" " : string diff --git a/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt b/tests/baselines/reference/trailingCommaInHeterogenousArrayLiteral1.errors.txt index b502eaad7e5..498e74ce350 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 '(string | number)[]' is not assignable to parameter of type 'number[]'. - Type 'string | number' is not assignable to type 'number'. +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'. Type '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'. +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'. 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 '(string | number)[]' is not assignable to parameter of type 'number[]'. -!!! error TS2345: Type 'string | number' is not assignable to type '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: Type 'string' is not assignable to type 'number'. this.test([1, 2, "hi", 5]); ~~~~~~~~~~~~~~~ -!!! 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: 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: 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 75f413eb170..8f418f98157 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 '() => string | number' is not assignable to type '() => number'. - Type 'string | number' is not assignable to type 'number'. + Type '() => number | string' is not assignable to type '() => number'. + Type 'number | string' 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 '() => string | number' is not assignable to type '() => number'. -!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! 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' 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 45ddf8cd949..eb0fcdcbbca 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 | Function | string[] +>Selector : string | string[] | Function >Function : Function export interface IStatic { diff --git a/tests/baselines/reference/typeGuardFunction.types b/tests/baselines/reference/typeGuardFunction.types index cf673f965f9..331d6aff07b 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 : B | C +>union2 : C | B >C : C >B : B @@ -226,6 +226,6 @@ let union3: boolean | B = isA(union2) || union2; >isA(union2) || union2 : boolean | B >isA(union2) : boolean >isA : (p1: any) => boolean ->union2 : B | C +>union2 : C | B >union2 : B diff --git a/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types b/tests/baselines/reference/typeGuardOfFormExpr1AndExpr2.types index 6714ecf5570..10f50bed52e 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 : boolean | C +>cOrBool : C | boolean >C : C var strOrNumOrBoolOrC: string | number | boolean | C; @@ -108,7 +108,7 @@ if (typeof strOrNumOrBoolOrC !== "string" && typeof strOrNumOrBoolOrC !== "numbe cOrBool = strOrNumOrBoolOrC; // C | boolean >cOrBool = strOrNumOrBoolOrC : boolean | C ->cOrBool : boolean | C +>cOrBool : C | boolean >strOrNumOrBoolOrC : boolean | C bool = strOrNumOrBool; // boolean diff --git a/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types b/tests/baselines/reference/typeGuardOfFormExpr1OrExpr2.types index 2cad437ddeb..acd929a7ca1 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 : boolean | C +>cOrBool : C | boolean >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 : boolean | C +>cOrBool : C | boolean >strOrNumOrBoolOrC : boolean | C bool = strOrNumOrBool; // boolean diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.types b/tests/baselines/reference/typeGuardOfFormInstanceOf.types index 891e8c1bea2..c824e907733 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.types @@ -121,7 +121,7 @@ str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1 >p1 : string var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 ->r2 : C2 | D1 +>r2 : D1 | C2 >D1 : D1 >C2 : C2 >c2Ord1 instanceof C1 && c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types index fe23d6d303e..20d1c1644fc 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types +++ b/tests/baselines/reference/typeGuardOfFormInstanceOfOnInterface.types @@ -151,7 +151,7 @@ str = c2Ord1 instanceof d1 && c2Ord1.p1; // D1 >p1 : string var r2: D1 | C2 = c2Ord1 instanceof c1 && c2Ord1; // C2 | D1 ->r2 : C2 | D1 +>r2 : D1 | C2 >D1 : D1 >C2 : C2 >c2Ord1 instanceof c1 && c2Ord1 : D1 diff --git a/tests/baselines/reference/typeGuardsDefeat.types b/tests/baselines/reference/typeGuardsDefeat.types index d3a017bd913..cc655d3ce0f 100644 --- a/tests/baselines/reference/typeGuardsDefeat.types +++ b/tests/baselines/reference/typeGuardsDefeat.types @@ -2,21 +2,21 @@ // Also note that it is possible to defeat a type guard by calling a function that changes the // type of the guarded variable. function foo(x: number | string) { ->foo : (x: string | number) => number ->x : string | number +>foo : (x: number | string) => number +>x : number | string function f() { >f : () => void x = 10; >x = 10 : number ->x : string | number +>x : number | string >10 : number } if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number +>x : number | string >"string" : string f(); @@ -35,13 +35,13 @@ function foo(x: number | string) { } } function foo2(x: number | string) { ->foo2 : (x: string | number) => number ->x : string | number +>foo2 : (x: number | string) => number +>x : number | string if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number +>x : number | string >"string" : string return x.length; // string @@ -63,7 +63,7 @@ function foo2(x: number | string) { } x = "hello"; >x = "hello" : string ->x : string | number +>x : number | string >"hello" : string f(); @@ -71,13 +71,13 @@ function foo2(x: number | string) { >f : () => number } function foo3(x: number | string) { ->foo3 : (x: string | number) => number ->x : string | number +>foo3 : (x: number | string) => number +>x : number | string if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number +>x : number | string >"string" : string return x.length; // string @@ -95,7 +95,7 @@ function foo3(x: number | string) { } x = "hello"; >x = "hello" : string ->x : string | number +>x : number | string >"hello" : string f(); diff --git a/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types b/tests/baselines/reference/typeGuardsInFunctionAndModuleBlock.types index 600b2720404..0a084d6eb54 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: string | number | boolean) => string ->x : string | number | boolean +>foo : (x: number | string | boolean) => string +>x : number | string | 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 : string | number | boolean +>x : number | string | boolean >"string" : string ? x @@ -46,14 +46,14 @@ function foo(x: number | string | boolean) { } (); } function foo2(x: number | string | boolean) { ->foo2 : (x: string | number | boolean) => string ->x : string | number | boolean +>foo2 : (x: number | string | boolean) => string +>x : number | string | 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 : string | number | boolean +>x : number | string | 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: string | number | boolean) => string ->x : string | number | boolean +>foo3 : (x: number | string | boolean) => string +>x : number | string | 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 : string | number | boolean +>x : number | string | boolean >"string" : string ? x @@ -136,14 +136,14 @@ function foo3(x: number | string | boolean) { })(); } function foo4(x: number | string | boolean) { ->foo4 : (x: string | number | boolean) => string ->x : string | number | boolean +>foo4 : (x: number | string | boolean) => string +>x : number | string | 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 : string | number | boolean +>x : number | string | boolean >"string" : string ? x @@ -183,13 +183,13 @@ function foo4(x: number | string | boolean) { } // Type guards affect nested function expressions, but not nested function declarations function foo5(x: number | string | boolean) { ->foo5 : (x: string | number | boolean) => void ->x : string | number | boolean +>foo5 : (x: number | string | boolean) => void +>x : number | string | boolean if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string var y = x; // string; @@ -200,8 +200,8 @@ function foo5(x: number | string | boolean) { >foo : () => void var z = x; // number | string | boolean, type guard has no effect ->z : string | number | boolean ->x : string | number | boolean +>z : number | string | boolean +>x : number | string | boolean } } } @@ -209,14 +209,14 @@ module m { >m : typeof m var x: number | string | boolean; ->x : string | number | boolean +>x : number | string | boolean module m2 { >m2 : typeof m2 var b = x; // new scope - number | boolean | string ->b : string | number | boolean ->x : string | number | boolean +>b : number | string | boolean +>x : number | string | boolean var y: string; >y : string @@ -224,7 +224,7 @@ module m { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string y = x // string; @@ -260,15 +260,15 @@ module m1 { >m1 : typeof m1 var x: number | string | boolean; ->x : string | number | boolean +>x : number | string | boolean module m2.m3 { >m2 : typeof m2 >m3 : typeof m3 var b = x; // new scope - number | boolean | string ->b : string | number | boolean ->x : string | number | boolean +>b : number | string | boolean +>x : number | string | boolean var y: string; >y : string @@ -276,7 +276,7 @@ module m1 { if (typeof x === "string") { >typeof x === "string" : boolean >typeof x : string ->x : string | number | boolean +>x : number | string | boolean >"string" : string y = x // string; diff --git a/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt b/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt index 4e6a8b83ae3..91d6d6998bc 100644 --- a/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt +++ b/tests/baselines/reference/typeGuardsOnClassProperty.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(14,70): error TS2339: Property 'join' does not exist on type 'string | string[]'. -tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,44): error TS2339: Property 'toLowerCase' does not exist on type 'string | number'. +tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,44): error TS2339: Property 'toLowerCase' does not exist on type 'number | string'. ==== tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts (2 errors) ==== @@ -32,6 +32,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,4 if (typeof o.prop1 === "string" && o.prop1.toLowerCase()) {} ~~~~~~~~~~~ -!!! error TS2339: Property 'toLowerCase' does not exist on type 'string | number'. +!!! error TS2339: Property 'toLowerCase' does not exist on type 'number | string'. var prop1 = o.prop1; if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt index 4960940d3ab..2f86b6797d7 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -6,8 +6,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru 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(111,10): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. -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(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(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'. @@ -164,10 +164,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 'string | F'. +!!! error TS2339: Property 'foo' does not exist on type 'F | string'. obj11.bar; ~~~ -!!! error TS2339: Property 'bar' does not exist on type 'string | F'. +!!! error TS2339: Property 'bar' does not exist on type 'F | string'. } var obj12: any; diff --git a/tests/baselines/reference/typeParameterAsElementType.types b/tests/baselines/reference/typeParameterAsElementType.types index 10e6787ae31..3b145b7f3cf 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 : (string | T)[] ->[t, ""] : (string | T)[] +>arr : (T | string)[] +>[t, ""] : (T | string)[] >t : T >"" : string } diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index 637467fc0d5..31b01c5f76e 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'] : (string | number | boolean)[] +>[true, 1, null, 'yes'] : (boolean | number | string)[] >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] : (string | number | boolean)[] +>[null, 0, 'yes', false] : (number | string | 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]) : (string | number | boolean)[] +>_.compact([0, 1, false, 2, '', 3]) : (number | boolean | string)[] >_.compact : (list: T[]) => T[] >_ : Underscore.Static >compact : (list: T[]) => T[] ->[0, 1, false, 2, '', 3] : (string | number | boolean)[] +>[0, 1, false, 2, '', 3] : (number | boolean | string)[] >0 : number >1 : number >false : boolean diff --git a/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt b/tests/baselines/reference/unionSubtypeIfEveryConstituentTypeIsSubtype.errors.txt index 013b5d9a990..7916c82c59b 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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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(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 'number | e' 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 (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 'number | e' is not assignable to string index type 'string'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'boolean'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'Date'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'RegExp'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type '{ bar: number; }'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'number[]'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'I8'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'A'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'A2'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type '(x: any) => number'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type '(x: T) => T'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'E2'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'typeof f'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'typeof c'. +!!! error TS2411: Property 'foo2' of type 'e | number' 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 'number | e' is not assignable to string index type 'T'. +!!! error TS2411: Property 'foo2' of type 'e | number' is not assignable to string index type 'T'. } interface I19 { diff --git a/tests/baselines/reference/unionTypeIndexSignature.types b/tests/baselines/reference/unionTypeIndexSignature.types index 6360e4b7b61..953a5f434fa 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 : boolean | { [a: string]: number; } +>unionOfTypesWithAndWithoutStringSignature : { [a: string]: number; } | boolean >a : string anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature["hello"] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature["hello"] : any ->unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; } +>unionOfTypesWithAndWithoutStringSignature : { [a: string]: number; } | boolean >"hello" : string anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature[10] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature[10] : any ->unionOfTypesWithAndWithoutStringSignature : boolean | { [a: string]: number; } +>unionOfTypesWithAndWithoutStringSignature : { [a: string]: number; } | boolean >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 : boolean | { [a: number]: number; } +>unionOfTypesWithAndWithoutStringSignature1 : { [a: number]: number; } | boolean >a : number anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature1["hello"] : any ->unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; } +>unionOfTypesWithAndWithoutStringSignature1 : { [a: number]: number; } | boolean >"hello" : string anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any >anyVar = unionOfTypesWithAndWithoutStringSignature1[10] : any >anyVar : number >unionOfTypesWithAndWithoutStringSignature1[10] : any ->unionOfTypesWithAndWithoutStringSignature1 : boolean | { [a: number]: number; } +>unionOfTypesWithAndWithoutStringSignature1 : { [a: number]: number; } | boolean >10 : number diff --git a/tests/baselines/reference/unionTypeInference.types b/tests/baselines/reference/unionTypeInference.types index 86cfd23dc76..58aa450c813 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" : string | number +>a1 || "hello" : number | string >a1 : number >"hello" : string diff --git a/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt b/tests/baselines/reference/unionTypePropertyAccessibility.errors.txt index ab60674ddc6..83e69cbcfc3 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 | 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(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 (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 | Protected | Private'. +!!! error TS2339: Property 'member' does not exist on type 'Public | Private | Protected'. v15.member; ~~~~~~ -!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Protected | Private'. +!!! error TS2339: Property 'member' does not exist on type 'Default | Public | Private | Protected'. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types index 361a3e90535..f609301c19c 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 : Module | Class | Namespace +>t.parent : Namespace | Module | Class >t : Class | Property ->parent : Module | Class | Namespace +>parent : Namespace | Module | Class diff --git a/tests/baselines/reference/unionTypesAssignability.errors.txt b/tests/baselines/reference/unionTypesAssignability.errors.txt index f1ede4c10fb..cad61f41d1d 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 'string | number' 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'. 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 'string | 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'. 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 'string | number' is not assignable to type 'number'. +!!! error TS2322: Type 'number | string' 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 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | string' 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