diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types b/tests/baselines/reference/aliasUsageInOrExpression.types index e7ca8639762..f009e7084eb 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.types +++ b/tests/baselines/reference/aliasUsageInOrExpression.types @@ -34,7 +34,7 @@ var d2: IHasVisualizationModel = i || moduleA; var d2: IHasVisualizationModel = moduleA || i; >d2 : IHasVisualizationModel >IHasVisualizationModel : IHasVisualizationModel ->moduleA || i : IHasVisualizationModel +>moduleA || i : typeof moduleA >moduleA : typeof moduleA >i : IHasVisualizationModel diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index 5650efc9ae7..e99114bc141 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -294,8 +294,8 @@ module EmptyTypes { // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; ->a1 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] +>a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -313,8 +313,8 @@ module EmptyTypes { >'a' : string var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; ->a2 : { x: any; y: string; }[] ->[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] >{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any @@ -332,8 +332,8 @@ module EmptyTypes { >'a' : string var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; ->a3 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -366,22 +366,22 @@ module EmptyTypes { >base2 : typeof base2 var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : iface[] ->[baseObj, base2Obj, ifaceObj] : iface[] +>b1 : base[] +>[baseObj, base2Obj, ifaceObj] : base[] >baseObj : base >base2Obj : base2 >ifaceObj : iface var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : iface[] ->[base2Obj, baseObj, ifaceObj] : iface[] +>b2 : base2[] +>[base2Obj, baseObj, ifaceObj] : base2[] >base2Obj : base2 >baseObj : base >ifaceObj : iface var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : iface[] ->[baseObj, ifaceObj, base2Obj] : iface[] +>b3 : base[] +>[baseObj, ifaceObj, base2Obj] : base[] >baseObj : base >ifaceObj : iface >base2Obj : base2 @@ -639,7 +639,7 @@ module NonEmptyTypes { >x : number >y : base >base : base ->[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: base; }[] +>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : ({ x: number; y: derived; } | { x: number; y: base; })[] >{ x: 7, y: new derived() } : { x: number; y: derived; } >x : number >7 : number @@ -658,7 +658,7 @@ module NonEmptyTypes { >x : boolean >y : base >base : base ->[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: base; }[] +>[{ x: true, y: new derived() }, { x: false, y: new base() }] : ({ x: boolean; y: derived; } | { x: boolean; y: base; })[] >{ x: true, y: new derived() } : { x: boolean; y: derived; } >x : boolean >true : boolean @@ -697,8 +697,8 @@ module NonEmptyTypes { // Order matters here so test all the variants var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }]; ->a1 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[] +>a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] +>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -716,8 +716,8 @@ module NonEmptyTypes { >'a' : string var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }]; ->a2 : { x: any; y: string; }[] ->[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] +>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[] >{ x: anyObj, y: 'a' } : { x: any; y: string; } >x : any >anyObj : any @@ -735,8 +735,8 @@ module NonEmptyTypes { >'a' : string var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }]; ->a3 : { x: any; y: string; }[] ->[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[] +>a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] +>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[] >{ x: 0, y: 'a' } : { x: number; y: string; } >x : number >0 : number @@ -769,29 +769,29 @@ module NonEmptyTypes { >base2 : typeof base2 var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : iface[] ->[baseObj, base2Obj, ifaceObj] : iface[] +>b1 : (iface | base | base2)[] +>[baseObj, base2Obj, ifaceObj] : (iface | base | base2)[] >baseObj : base >base2Obj : base2 >ifaceObj : iface var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : iface[] ->[base2Obj, baseObj, ifaceObj] : iface[] +>b2 : (iface | base | base2)[] +>[base2Obj, baseObj, ifaceObj] : (iface | base | base2)[] >base2Obj : base2 >baseObj : base >ifaceObj : iface var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : iface[] ->[baseObj, ifaceObj, base2Obj] : iface[] +>b3 : (iface | base | base2)[] +>[baseObj, ifaceObj, base2Obj] : (iface | base | base2)[] >baseObj : base >ifaceObj : iface >base2Obj : base2 var b4 = [ifaceObj, baseObj, base2Obj]; ->b4 : iface[] ->[ifaceObj, baseObj, base2Obj] : iface[] +>b4 : (iface | base | base2)[] +>[ifaceObj, baseObj, base2Obj] : (iface | base | base2)[] >ifaceObj : iface >baseObj : base >base2Obj : base2 diff --git a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types index aad515b62ee..b2f83729030 100644 --- a/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types +++ b/tests/baselines/reference/arrayLiteralWithMultipleBestCommonTypes.types @@ -36,8 +36,8 @@ var cs = [a, b, c]; // { x: number; y?: number };[] >c : { x: number; a?: number; } var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[] ->ds : ((x: Object) => number)[] ->[(x: Object) => 1, (x: string) => 2] : ((x: Object) => number)[] +>ds : (((x: Object) => number) | ((x: string) => number))[] +>[(x: Object) => 1, (x: string) => 2] : (((x: Object) => number) | ((x: string) => number))[] >(x: Object) => 1 : (x: Object) => number >x : Object >Object : Object @@ -47,8 +47,8 @@ var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[] >2 : number var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[] ->es : ((x: string) => number)[] ->[(x: string) => 2, (x: Object) => 1] : ((x: string) => number)[] +>es : (((x: string) => number) | ((x: Object) => number))[] +>[(x: string) => 2, (x: Object) => 1] : (((x: string) => number) | ((x: Object) => number))[] >(x: string) => 2 : (x: string) => number >x : string >2 : number diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types index 9cdbe0a0a61..b7224fe91c4 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types @@ -77,8 +77,8 @@ var myDerivedList: DerivedList; >DerivedList : DerivedList var as = [list, myDerivedList]; // List[] ->as : List[] ->[list, myDerivedList] : List[] +>as : (List | DerivedList)[] +>[list, myDerivedList] : (List | DerivedList)[] >list : List >myDerivedList : DerivedList diff --git a/tests/baselines/reference/arrayOfFunctionTypes3.types b/tests/baselines/reference/arrayOfFunctionTypes3.types index 0ed92991ed0..b2378b3dc70 100644 --- a/tests/baselines/reference/arrayOfFunctionTypes3.types +++ b/tests/baselines/reference/arrayOfFunctionTypes3.types @@ -2,8 +2,8 @@ // valid uses of arrays of function types var x = [() => 1, () => { }]; ->x : (() => void)[] ->[() => 1, () => { }] : (() => void)[] +>x : ((() => number) | (() => void))[] +>[() => 1, () => { }] : ((() => number) | (() => void))[] >() => 1 : () => number >1 : number >() => { } : () => void @@ -11,8 +11,8 @@ var x = [() => 1, () => { }]; var r2 = x[0](); >r2 : void >x[0]() : void ->x[0] : () => void ->x : (() => void)[] +>x[0] : (() => number) | (() => void) +>x : ((() => number) | (() => void))[] >0 : number class C { @@ -50,28 +50,28 @@ var c: { (x: number): number; (x: any): any; }; >x : any var z = [a, b, c]; ->z : { (x: number): number; (x: any): any; }[] ->[a, b, c] : { (x: number): number; (x: any): any; }[] +>z : ({ (x: number): number; (x: string): string; } | { (x: number): number; (x: any): any; })[] +>[a, b, c] : ({ (x: number): number; (x: string): string; } | { (x: number): number; (x: any): any; })[] >a : { (x: number): number; (x: string): string; } >b : { (x: number): number; (x: string): string; } >c : { (x: number): number; (x: any): any; } var r4 = z[0]; ->r4 : { (x: number): number; (x: any): any; } ->z[0] : { (x: number): number; (x: any): any; } ->z : { (x: number): number; (x: any): any; }[] +>r4 : { (x: number): number; (x: string): string; } | { (x: number): number; (x: any): any; } +>z[0] : { (x: number): number; (x: string): string; } | { (x: number): number; (x: any): any; } +>z : ({ (x: number): number; (x: string): string; } | { (x: number): number; (x: any): any; })[] >0 : number var r5 = r4(''); // any not string >r5 : any >r4('') : any ->r4 : { (x: number): number; (x: any): any; } +>r4 : { (x: number): number; (x: string): string; } | { (x: number): number; (x: any): any; } >'' : string var r5b = r4(1); >r5b : number >r4(1) : number ->r4 : { (x: number): number; (x: any): any; } +>r4 : { (x: number): number; (x: string): string; } | { (x: number): number; (x: any): any; } >1 : number var a2: { (x: T): number; (x: string): string;}; @@ -96,21 +96,21 @@ var c2: { (x: number): number; (x: T): any; }; >T : T var z2 = [a2, b2, c2]; ->z2 : { (x: number): number; (x: T): any; }[] ->[a2, b2, c2] : { (x: number): number; (x: T): any; }[] +>z2 : ({ (x: T): number; (x: string): string; } | { (x: number): number; (x: T): any; })[] +>[a2, b2, c2] : ({ (x: T): number; (x: string): string; } | { (x: number): number; (x: T): any; })[] >a2 : { (x: T): number; (x: string): string; } >b2 : { (x: T): number; (x: string): string; } >c2 : { (x: number): number; (x: T): any; } var r6 = z2[0]; ->r6 : { (x: number): number; (x: T): any; } ->z2[0] : { (x: number): number; (x: T): any; } ->z2 : { (x: number): number; (x: T): any; }[] +>r6 : { (x: T): number; (x: string): string; } | { (x: number): number; (x: T): any; } +>z2[0] : { (x: T): number; (x: string): string; } | { (x: number): number; (x: T): any; } +>z2 : ({ (x: T): number; (x: string): string; } | { (x: number): number; (x: T): any; })[] >0 : number var r7 = r6(''); // any not string >r7 : any >r6('') : any ->r6 : { (x: number): number; (x: T): any; } +>r6 : { (x: T): number; (x: string): string; } | { (x: number): number; (x: T): any; } >'' : string diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types index 2a5ee6a2fe2..bbdc5afe931 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.types @@ -46,8 +46,8 @@ var r = true ? 1 : 2; >2 : number var r3 = true ? 1 : {}; ->r3 : {} ->true ? 1 : {} : {} +>r3 : number | {} +>true ? 1 : {} : number | {} >true : boolean >1 : number >{} : {} @@ -67,8 +67,8 @@ var r5 = true ? b : a; // typeof b >a : { x: number; y?: number; } var r6 = true ? (x: number) => { } : (x: Object) => { }; // returns number => void ->r6 : (x: number) => void ->true ? (x: number) => { } : (x: Object) => { } : (x: number) => void +>r6 : ((x: number) => void) | ((x: Object) => void) +>true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void) >true : boolean >(x: number) => { } : (x: number) => void >x : number @@ -80,7 +80,7 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; >r7 : (x: Object) => void >x : Object >Object : Object ->true ? (x: number) => { } : (x: Object) => { } : (x: number) => void +>true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void) >true : boolean >(x: number) => { } : (x: number) => void >x : number @@ -89,8 +89,8 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { }; >Object : Object var r8 = true ? (x: Object) => { } : (x: number) => { }; // returns Object => void ->r8 : (x: Object) => void ->true ? (x: Object) => { } : (x: number) => { } : (x: Object) => void +>r8 : ((x: Object) => void) | ((x: number) => void) +>true ? (x: Object) => { } : (x: number) => { } : ((x: Object) => void) | ((x: number) => void) >true : boolean >(x: Object) => { } : (x: Object) => void >x : Object @@ -107,8 +107,8 @@ var r10: Base = true ? derived : derived2; // no error since we use the contextu >derived2 : Derived2 var r11 = true ? base : derived2; ->r11 : Base ->true ? base : derived2 : Base +>r11 : Base | Derived2 +>true ? base : derived2 : Base | Derived2 >true : boolean >base : Base >derived2 : Derived2 diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.types b/tests/baselines/reference/bestCommonTypeOfTuple.types index 7b7302a9cc2..6aa84f37eba 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple.types @@ -98,8 +98,8 @@ var e3 = t3[2]; // any >2 : number var e4 = t4[3]; // number ->e4 : number ->t4[3] : number +>e4 : number | E1 | E2 +>t4[3] : number | E1 | E2 >t4 : [E1, E2, number] >3 : number diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.types b/tests/baselines/reference/bestCommonTypeOfTuple2.types index 32196fdf668..864d3030d88 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.types +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.types @@ -66,8 +66,8 @@ var t5: [C1, F] >F : F var e11 = t1[4]; // base ->e11 : base ->t1[4] : base +>e11 : base | C +>t1[4] : base | C >t1 : [C, base] >4 : number @@ -78,14 +78,14 @@ var e21 = t2[4]; // {} >4 : number var e31 = t3[4]; // C1 ->e31 : C1 ->t3[4] : C1 +>e31 : C1 | D1 +>t3[4] : C1 | D1 >t3 : [C1, D1] >4 : number var e41 = t4[2]; // base1 ->e41 : base1 ->t4[2] : base1 +>e41 : base1 | C1 +>t4[2] : base1 | C1 >t4 : [base1, C1] >2 : number diff --git a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types index df40291b0e5..ce75da3fab9 100644 --- a/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types +++ b/tests/baselines/reference/bestCommonTypeWithOptionalProperties.types @@ -27,43 +27,43 @@ var z: Z; // All these arrays should be X[] var b1 = [x, y, z]; ->b1 : X[] ->[x, y, z] : X[] +>b1 : (X | Y | Z)[] +>[x, y, z] : (X | Y | Z)[] >x : X >y : Y >z : Z var b2 = [x, z, y]; ->b2 : X[] ->[x, z, y] : X[] +>b2 : (X | Y | Z)[] +>[x, z, y] : (X | Y | Z)[] >x : X >z : Z >y : Y var b3 = [y, x, z]; ->b3 : X[] ->[y, x, z] : X[] +>b3 : (X | Y | Z)[] +>[y, x, z] : (X | Y | Z)[] >y : Y >x : X >z : Z var b4 = [y, z, x]; ->b4 : X[] ->[y, z, x] : X[] +>b4 : (X | Y | Z)[] +>[y, z, x] : (X | Y | Z)[] >y : Y >z : Z >x : X var b5 = [z, x, y]; ->b5 : X[] ->[z, x, y] : X[] +>b5 : (X | Y | Z)[] +>[z, x, y] : (X | Y | Z)[] >z : Z >x : X >y : Y var b6 = [z, y, x]; ->b6 : X[] ->[z, y, x] : X[] +>b6 : (X | Y | Z)[] +>[z, y, x] : (X | Y | Z)[] >z : Z >y : Y >x : X diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types index 722ec13c684..fe27f05df03 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.types @@ -31,27 +31,27 @@ var b: B; //Cond ? Expr1 : Expr2, Expr1 is supertype //Be Not contextually typed true ? x : a; ->true ? x : a : X +>true ? x : a : X | A >true : boolean >x : X >a : A var result1 = true ? x : a; ->result1 : X ->true ? x : a : X +>result1 : X | A +>true ? x : a : X | A >true : boolean >x : X >a : A //Expr1 and Expr2 are literals true ? {} : 1; ->true ? {} : 1 : {} +>true ? {} : 1 : number | {} >true : boolean >{} : {} >1 : number true ? { a: 1 } : { a: 2, b: 'string' }; ->true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } +>true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } | { a: number; b: string; } >true : boolean >{ a: 1 } : { a: number; } >a : number @@ -63,15 +63,15 @@ true ? { a: 1 } : { a: 2, b: 'string' }; >'string' : string var result2 = true ? {} : 1; ->result2 : {} ->true ? {} : 1 : {} +>result2 : number | {} +>true ? {} : 1 : number | {} >true : boolean >{} : {} >1 : number var result3 = true ? { a: 1 } : { a: 2, b: 'string' }; ->result3 : { a: number; } ->true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } +>result3 : { a: number; } | { a: number; b: string; } +>true ? { a: 1 } : { a: 2, b: 'string' } : { a: number; } | { a: number; b: string; } >true : boolean >{ a: 1 } : { a: number; } >a : number @@ -86,7 +86,7 @@ var result3 = true ? { a: 1 } : { a: 2, b: 'string' }; var resultIsX1: X = true ? x : a; >resultIsX1 : X >X : X ->true ? x : a : X +>true ? x : a : X | A >true : boolean >x : X >a : A @@ -95,7 +95,7 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA; >result4 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyX : (n) => n.propertyA : (m: A) => any +>true ? (m) => m.propertyX : (n) => n.propertyA : ((m: A) => any) | ((n: A) => number) >true : boolean >(m) => m.propertyX : (m: A) => any >m : A @@ -111,27 +111,27 @@ 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 +>true ? a : x : X | A >true : boolean >a : A >x : X var result5 = true ? a : x; ->result5 : X ->true ? a : x : X +>result5 : X | A +>true ? a : x : X | A >true : boolean >a : A >x : X //Expr1 and Expr2 are literals true ? 1 : {}; ->true ? 1 : {} : {} +>true ? 1 : {} : number | {} >true : boolean >1 : number >{} : {} true ? { a: 2, b: 'string' } : { a: 1 }; ->true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; } +>true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; b: string; } | { a: number; } >true : boolean >{ a: 2, b: 'string' } : { a: number; b: string; } >a : number @@ -143,15 +143,15 @@ true ? { a: 2, b: 'string' } : { a: 1 }; >1 : number var result6 = true ? 1 : {}; ->result6 : {} ->true ? 1 : {} : {} +>result6 : number | {} +>true ? 1 : {} : number | {} >true : boolean >1 : number >{} : {} var result7 = true ? { a: 2, b: 'string' } : { a: 1 }; ->result7 : { a: number; } ->true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; } +>result7 : { a: number; b: string; } | { a: number; } +>true ? { a: 2, b: 'string' } : { a: 1 } : { a: number; b: string; } | { a: number; } >true : boolean >{ a: 2, b: 'string' } : { a: number; b: string; } >a : number @@ -166,7 +166,7 @@ var result7 = true ? { a: 2, b: 'string' } : { a: 1 }; var resultIsX2: X = true ? x : a; >resultIsX2 : X >X : X ->true ? x : a : X +>true ? x : a : X | A >true : boolean >x : X >a : A @@ -175,7 +175,7 @@ var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX; >result8 : (t: A) => any >t : A >A : A ->true ? (m) => m.propertyA : (n) => n.propertyX : (n: A) => any +>true ? (m) => m.propertyA : (n) => n.propertyX : ((m: A) => number) | ((n: A) => any) >true : boolean >(m) => m.propertyA : (m: A) => number >m : A diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types index c51227fd13a..8f2abf37e0e 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types @@ -187,7 +187,7 @@ var arrayI1OrI2: Array | I2> = [i1, i2, { // Like i1 >Array : T[] >I1 : I1 >I2 : I2 ->[i1, i2, { // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", }, { // Like i2 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }, { // Like i1 and i2 both commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }] : (I1 | I2)[] +>[i1, i2, { // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", }, { // Like i2 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }, { // Like i1 and i2 both commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", methodOnlyInI2: a => a, propertyOnlyInI2: "Hello", }] : (I1 | I2 | { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; methodOnlyInI2: (a: string) => string; propertyOnlyInI2: string; })[] >i1 : I1 >i2 : I2 >{ // Like i1 commonPropertyType: "hello", commonMethodType: a=> a, commonMethodWithTypeParameter: a => a, methodOnlyInI1: a => a, propertyOnlyInI1: "Hello", } : { commonPropertyType: string; commonMethodType: (a: string) => string; commonMethodWithTypeParameter: (a: number) => number; methodOnlyInI1: (a: string) => string; propertyOnlyInI1: string; } diff --git a/tests/baselines/reference/contextualTyping12.errors.txt b/tests/baselines/reference/contextualTyping12.errors.txt new file mode 100644 index 00000000000..e1f05b432dc --- /dev/null +++ b/tests/baselines/reference/contextualTyping12.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/contextualTyping12.ts(1,13): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Property 'name' does not exist on type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping12.ts (1 errors) ==== + class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping12.symbols b/tests/baselines/reference/contextualTyping12.symbols deleted file mode 100644 index bafef4c8e0a..00000000000 --- a/tests/baselines/reference/contextualTyping12.symbols +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/compiler/contextualTyping12.ts === -class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; } ->foo : Symbol(foo, Decl(contextualTyping12.ts, 0, 0)) ->bar : Symbol(bar, Decl(contextualTyping12.ts, 0, 11)) ->id : Symbol(id, Decl(contextualTyping12.ts, 0, 24)) ->id : Symbol(id, Decl(contextualTyping12.ts, 0, 42)) ->id : Symbol(id, Decl(contextualTyping12.ts, 0, 50)) ->name : Symbol(name, Decl(contextualTyping12.ts, 0, 55)) - diff --git a/tests/baselines/reference/contextualTyping12.types b/tests/baselines/reference/contextualTyping12.types deleted file mode 100644 index 68e2663fb6a..00000000000 --- a/tests/baselines/reference/contextualTyping12.types +++ /dev/null @@ -1,15 +0,0 @@ -=== tests/cases/compiler/contextualTyping12.ts === -class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; } ->foo : foo ->bar : { id: number; }[] ->id : number ->[{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->{id:2, name:"foo"} : { id: number; name: string; } ->id : number ->2 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping20.errors.txt b/tests/baselines/reference/contextualTyping20.errors.txt new file mode 100644 index 00000000000..7fc6b9a5e13 --- /dev/null +++ b/tests/baselines/reference/contextualTyping20.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/contextualTyping20.ts(1,36): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Property 'name' does not exist on type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping20.ts (1 errors) ==== + var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}]; + ~~~ +!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping20.symbols b/tests/baselines/reference/contextualTyping20.symbols deleted file mode 100644 index 505c6a04a59..00000000000 --- a/tests/baselines/reference/contextualTyping20.symbols +++ /dev/null @@ -1,10 +0,0 @@ -=== tests/cases/compiler/contextualTyping20.ts === -var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}]; ->foo : Symbol(foo, Decl(contextualTyping20.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 9)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 27)) ->foo : Symbol(foo, Decl(contextualTyping20.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 43)) ->id : Symbol(id, Decl(contextualTyping20.ts, 0, 51)) ->name : Symbol(name, Decl(contextualTyping20.ts, 0, 56)) - diff --git a/tests/baselines/reference/contextualTyping20.types b/tests/baselines/reference/contextualTyping20.types deleted file mode 100644 index be863db836b..00000000000 --- a/tests/baselines/reference/contextualTyping20.types +++ /dev/null @@ -1,20 +0,0 @@ -=== tests/cases/compiler/contextualTyping20.ts === -var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}]; ->foo : { id: number; }[] ->id : number ->[{id:1}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->foo = [{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->foo : { id: number; }[] ->[{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->{id:2, name:"foo"} : { id: number; name: string; } ->id : number ->2 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTyping37.types b/tests/baselines/reference/contextualTyping37.types index 299b4400137..8acd4aedf04 100644 --- a/tests/baselines/reference/contextualTyping37.types +++ b/tests/baselines/reference/contextualTyping37.types @@ -3,7 +3,7 @@ var foo = <{ id: number; }[]>[{ foo: "s" }, { }]; >foo : { id: number; }[] ><{ id: number; }[]>[{ foo: "s" }, { }] : { id: number; }[] >id : number ->[{ foo: "s" }, { }] : {}[] +>[{ foo: "s" }, { }] : ({ foo: string; } | {})[] >{ foo: "s" } : { foo: string; } >foo : string >"s" : string diff --git a/tests/baselines/reference/contextualTyping9.errors.txt b/tests/baselines/reference/contextualTyping9.errors.txt new file mode 100644 index 00000000000..45148e83a11 --- /dev/null +++ b/tests/baselines/reference/contextualTyping9.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/contextualTyping9.ts(1,5): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. + Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. + Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. + Property 'name' does not exist on type '{ id: number; }'. + + +==== tests/cases/compiler/contextualTyping9.ts (1 errors) ==== + var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; + ~~~ +!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'. +!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2322: Property 'name' does not exist on type '{ id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping9.symbols b/tests/baselines/reference/contextualTyping9.symbols deleted file mode 100644 index f9ef2220c20..00000000000 --- a/tests/baselines/reference/contextualTyping9.symbols +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/compiler/contextualTyping9.ts === -var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; ->foo : Symbol(foo, Decl(contextualTyping9.ts, 0, 3)) ->id : Symbol(id, Decl(contextualTyping9.ts, 0, 9)) ->id : Symbol(id, Decl(contextualTyping9.ts, 0, 27)) ->id : Symbol(id, Decl(contextualTyping9.ts, 0, 35)) ->name : Symbol(name, Decl(contextualTyping9.ts, 0, 40)) - diff --git a/tests/baselines/reference/contextualTyping9.types b/tests/baselines/reference/contextualTyping9.types deleted file mode 100644 index 46480d64b30..00000000000 --- a/tests/baselines/reference/contextualTyping9.types +++ /dev/null @@ -1,14 +0,0 @@ -=== tests/cases/compiler/contextualTyping9.ts === -var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; ->foo : { id: number; }[] ->id : number ->[{id:1}, {id:2, name:"foo"}] : { id: number; }[] ->{id:1} : { id: number; } ->id : number ->1 : number ->{id:2, name:"foo"} : { id: number; name: string; } ->id : number ->2 : number ->name : string ->"foo" : string - diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.types b/tests/baselines/reference/contextualTypingArrayOfLambdas.types index d3e5b9942e3..0bb61604336 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.types +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.types @@ -23,8 +23,8 @@ class C extends A { } var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; ->xs : ((x: A) => void)[] ->[(x: A) => { }, (x: B) => { }, (x: C) => { }] : ((x: A) => void)[] +>xs : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[] +>[(x: A) => { }, (x: B) => { }, (x: C) => { }] : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[] >(x: A) => { } : (x: A) => void >x : A >A : A diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt index 53ecb88363d..098afe94b47 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. @@ -79,7 +79,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. for( var arr = [new C(), new C2(), new D()];;){} ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. for(var arr2 = [new D()];;){} for( var arr2 = new Array>();;){} diff --git a/tests/baselines/reference/functionImplementations.types b/tests/baselines/reference/functionImplementations.types index f277821d696..f2c1a607dd3 100644 --- a/tests/baselines/reference/functionImplementations.types +++ b/tests/baselines/reference/functionImplementations.types @@ -342,7 +342,7 @@ var f7: (x: number) => string | number = x => { // should be (x: number) => numb var f8: (x: number) => any = x => { // should be (x: number) => Base >f8 : (x: number) => any >x : number ->x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base +>x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base | Derived2 >x : number return new Base(); @@ -356,7 +356,7 @@ var f8: (x: number) => any = x => { // should be (x: number) => Base var f9: (x: number) => any = x => { // should be (x: number) => Base >f9 : (x: number) => any >x : number ->x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base +>x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base | Derived | Derived2 >x : number return new Base(); diff --git a/tests/baselines/reference/generatedContextualTyping.types b/tests/baselines/reference/generatedContextualTyping.types index e8f434d31a8..f89034dbd83 100644 --- a/tests/baselines/reference/generatedContextualTyping.types +++ b/tests/baselines/reference/generatedContextualTyping.types @@ -2125,8 +2125,8 @@ var x216 = >{ func: n => { return [d1, d2]; } }; >d2 : Derived2 var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; ->x217 : () => Base[] ->(<() => Base[]>undefined) || function() { return [d1, d2] } : () => Base[] +>x217 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<() => Base[]>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base @@ -2137,8 +2137,8 @@ var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] }; >d2 : Derived2 var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; ->x218 : () => Base[] ->(<() => Base[]>undefined) || function named() { return [d1, d2] } : () => Base[] +>x218 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<() => Base[]>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<() => Base[]>undefined) : () => Base[] ><() => Base[]>undefined : () => Base[] >Base : Base @@ -2150,8 +2150,8 @@ var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] }; >d2 : Derived2 var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; ->x219 : () => Base[] ->(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : () => Base[] +>x219 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base @@ -2162,8 +2162,8 @@ var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] }; >d2 : Derived2 var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; ->x220 : () => Base[] ->(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : () => Base[] +>x220 : (() => Base[]) | (() => (Derived1 | Derived2)[]) +>(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[]) >(<{ (): Base[]; }>undefined) : () => Base[] ><{ (): Base[]; }>undefined : () => Base[] >Base : Base @@ -2175,8 +2175,8 @@ var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] }; >d2 : Derived2 var x221 = (undefined) || [d1, d2]; ->x221 : Base[] ->(undefined) || [d1, d2] : Base[] +>x221 : Base[] | (Derived1 | Derived2)[] +>(undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[] >(undefined) : Base[] >undefined : Base[] >Base : Base @@ -2186,8 +2186,8 @@ var x221 = (undefined) || [d1, d2]; >d2 : Derived2 var x222 = (>undefined) || [d1, d2]; ->x222 : Base[] ->(>undefined) || [d1, d2] : Base[] +>x222 : Base[] | (Derived1 | Derived2)[] +>(>undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[] >(>undefined) : Base[] >>undefined : Base[] >Array : T[] @@ -2198,8 +2198,8 @@ var x222 = (>undefined) || [d1, d2]; >d2 : Derived2 var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; ->x223 : { [n: number]: Base; } ->(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; } +>x223 : (Derived1 | Derived2)[] | { [n: number]: Base; } +>(<{ [n: number]: Base; }>undefined) || [d1, d2] : (Derived1 | Derived2)[] | { [n: number]: Base; } >(<{ [n: number]: Base; }>undefined) : { [n: number]: Base; } ><{ [n: number]: Base; }>undefined : { [n: number]: Base; } >n : number @@ -2210,8 +2210,8 @@ var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2]; >d2 : Derived2 var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] }; ->x224 : { n: Base[]; } ->(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } +>x224 : { n: Base[]; } | { n: (Derived1 | Derived2)[]; } +>(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } | { n: (Derived1 | Derived2)[]; } >(<{n: Base[]; } >undefined) : { n: Base[]; } ><{n: Base[]; } >undefined : { n: Base[]; } >n : Base[] diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types b/tests/baselines/reference/heterogeneousArrayLiterals.types index ecfbf75e864..b453d7540c0 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.types +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types @@ -21,14 +21,14 @@ var c = [1, '', null]; // {}[] >null : null var d = [{}, 1]; // {}[] ->d : {}[] ->[{}, 1] : {}[] +>d : (number | {})[] +>[{}, 1] : (number | {})[] >{} : {} >1 : number var e = [{}, Object]; // {}[] ->e : {}[] ->[{}, Object] : {}[] +>e : (ObjectConstructor | {})[] +>[{}, Object] : (ObjectConstructor | {})[] >{} : {} >Object : ObjectConstructor @@ -48,8 +48,8 @@ var g = [[1], ['']]; // {}[] >'' : string var h = [{ foo: 1, bar: '' }, { foo: 2 }]; // {foo: number}[] ->h : { foo: number; }[] ->[{ foo: 1, bar: '' }, { foo: 2 }] : { foo: number; }[] +>h : ({ foo: number; bar: string; } | { foo: number; })[] +>[{ foo: 1, bar: '' }, { foo: 2 }] : ({ foo: number; bar: string; } | { foo: number; })[] >{ foo: 1, bar: '' } : { foo: number; bar: string; } >foo : number >1 : number @@ -88,16 +88,16 @@ var k = [() => 1, () => 1]; // { (): number }[] >1 : number var l = [() => 1, () => null]; // { (): any }[] ->l : (() => any)[] ->[() => 1, () => null] : (() => any)[] +>l : ((() => number) | (() => any))[] +>[() => 1, () => null] : ((() => number) | (() => any))[] >() => 1 : () => number >1 : number >() => null : () => any >null : null var m = [() => 1, () => '', () => null]; // { (): any }[] ->m : (() => any)[] ->[() => 1, () => '', () => null] : (() => any)[] +>m : ((() => number) | (() => string) | (() => any))[] +>[() => 1, () => '', () => null] : ((() => number) | (() => string) | (() => any))[] >() => 1 : () => number >1 : number >() => '' : () => string @@ -145,8 +145,8 @@ module Derived { >Derived : typeof Derived var h = [{ foo: base, basear: derived }, { foo: base }]; // {foo: Base}[] ->h : { foo: Base; }[] ->[{ foo: base, basear: derived }, { foo: base }] : { foo: Base; }[] +>h : ({ foo: Base; basear: Derived; } | { foo: Base; })[] +>[{ foo: base, basear: derived }, { foo: base }] : ({ foo: Base; basear: Derived; } | { foo: Base; })[] >{ foo: base, basear: derived } : { foo: Base; basear: Derived; } >foo : Base >base : Base @@ -169,8 +169,8 @@ module Derived { >derived : Derived var j = [() => base, () => derived]; // { {}: Base } ->j : (() => Base)[] ->[() => base, () => derived] : (() => Base)[] +>j : ((() => Base) | (() => Derived))[] +>[() => base, () => derived] : ((() => Base) | (() => Derived))[] >() => base : () => Base >base : Base >() => derived : () => Derived @@ -185,16 +185,16 @@ module Derived { >1 : number var l = [() => base, () => null]; // { (): any }[] ->l : (() => any)[] ->[() => base, () => null] : (() => any)[] +>l : ((() => Base) | (() => any))[] +>[() => base, () => null] : ((() => Base) | (() => any))[] >() => base : () => Base >base : Base >() => null : () => any >null : null var m = [() => base, () => derived, () => null]; // { (): any }[] ->m : (() => any)[] ->[() => base, () => derived, () => null] : (() => any)[] +>m : ((() => Base) | (() => Derived) | (() => any))[] +>[() => base, () => derived, () => null] : ((() => Base) | (() => Derived) | (() => any))[] >() => base : () => Base >base : Base >() => derived : () => Derived @@ -203,8 +203,8 @@ module Derived { >null : null var n = [[() => base], [() => derived]]; // { (): Base }[] ->n : (() => Base)[][] ->[[() => base], [() => derived]] : (() => Base)[][] +>n : ((() => Base)[] | (() => Derived)[])[] +>[[() => base], [() => derived]] : ((() => Base)[] | (() => Derived)[])[] >[() => base] : (() => Base)[] >() => base : () => Base >base : Base @@ -219,8 +219,8 @@ module Derived { >derived2 : Derived2 var p = [derived, derived2, base]; // Base[] ->p : Base[] ->[derived, derived2, base] : Base[] +>p : (Base | Derived | Derived2)[] +>[derived, derived2, base] : (Base | Derived | Derived2)[] >derived : Derived >derived2 : Derived2 >base : Base @@ -310,8 +310,8 @@ function foo(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -364,8 +364,8 @@ function foo2(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -374,8 +374,8 @@ function foo2(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : Base[] ->[t, base] : Base[] +>g : (Base | T)[] +>[t, base] : (Base | T)[] >t : T >base : Base @@ -386,14 +386,14 @@ function foo2(t: T, u: U) { >derived : Derived var i = [u, base]; // Base[] ->i : Base[] ->[u, base] : Base[] +>i : (Base | U)[] +>[u, base] : (Base | U)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : Derived[] ->[u, derived] : Derived[] +>j : (Derived | U)[] +>[u, derived] : (Derived | U)[] >u : U >derived : Derived } @@ -442,8 +442,8 @@ function foo3(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -452,26 +452,26 @@ function foo3(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : Base[] ->[t, base] : Base[] +>g : (Base | T)[] +>[t, base] : (Base | T)[] >t : T >base : Base var h = [t, derived]; // Derived[] ->h : Derived[] ->[t, derived] : Derived[] +>h : (Derived | T)[] +>[t, derived] : (Derived | T)[] >t : T >derived : Derived var i = [u, base]; // Base[] ->i : Base[] ->[u, base] : Base[] +>i : (Base | U)[] +>[u, base] : (Base | U)[] >u : U >base : Base var j = [u, derived]; // Derived[] ->j : Derived[] ->[u, derived] : Derived[] +>j : (Derived | U)[] +>[u, derived] : (Derived | U)[] >u : U >derived : Derived } @@ -520,8 +520,8 @@ function foo4(t: T, u: U) { >u : U var f = [() => t, () => u, () => null]; // { (): any }[] ->f : (() => any)[] ->[() => t, () => u, () => null] : (() => any)[] +>f : ((() => T) | (() => U) | (() => any))[] +>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[] >() => t : () => T >t : T >() => u : () => U @@ -530,8 +530,8 @@ function foo4(t: T, u: U) { >null : null var g = [t, base]; // Base[] ->g : Base[] ->[t, base] : Base[] +>g : (Base | T)[] +>[t, base] : (Base | T)[] >t : T >base : Base @@ -542,8 +542,8 @@ function foo4(t: T, u: U) { >derived : Derived var i = [u, base]; // Base[] ->i : Base[] ->[u, base] : Base[] +>i : (Base | U)[] +>[u, base] : (Base | U)[] >u : U >base : Base diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt index 3ec718f3b25..0c4b95214b0 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. @@ -79,7 +79,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. var arr = [new C(), new C2(), new D()]; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D)[]'. var arr2 = [new D()]; var arr2 = new Array>(); diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types b/tests/baselines/reference/logicalOrOperatorWithEveryType.types index ecf6b23e729..5f6369cbf8c 100644 --- a/tests/baselines/reference/logicalOrOperatorWithEveryType.types +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types @@ -187,8 +187,8 @@ var rc5 = a5 || a3; // void || number is void | number >a3 : number var rc6 = a6 || a3; // enum || number is number ->rc6 : number ->a6 || a3 : number +>rc6 : number | E +>a6 || a3 : number | E >a6 : E >a3 : number @@ -349,8 +349,8 @@ var rg2 = a2 || a6; // boolean || enum is boolean | enum >a6 : E var rg3 = a3 || a6; // number || enum is number ->rg3 : number ->a3 || a6 : number +>rg3 : number | E +>a3 || a6 : number | E >a3 : number >a6 : E diff --git a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types index f887ad7ae14..df8f6cac6db 100644 --- a/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types +++ b/tests/baselines/reference/logicalOrOperatorWithTypeParameters.types @@ -107,8 +107,8 @@ function fn3u : U var r3 = t || { a: '' }; ->r3 : { a: string; } ->t || { a: '' } : { a: string; } +>r3 : T | { a: string; } +>t || { a: '' } : T | { a: string; } >t : T >{ a: '' } : { a: string; } >a : string diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index 7f73ac6da0a..da9184661b3 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; 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]: 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; }'. Index signatures are incompatible. - Type 'number | A' is not assignable to type 'A'. + Type 'number | A | B' 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; 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]: 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: Index signatures are incompatible. -!!! error TS2322: Type 'number | A' is not assignable to type 'A'. +!!! error TS2322: Type 'number | A | B' 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 c35e49f02a3..09d35cfd493 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; [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]: A | B; [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; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! 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: 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/objectLiteralIndexers.types b/tests/baselines/reference/objectLiteralIndexers.types index d5add00ebaf..55cec857c70 100644 --- a/tests/baselines/reference/objectLiteralIndexers.types +++ b/tests/baselines/reference/objectLiteralIndexers.types @@ -31,7 +31,7 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer i >A : A >n : number >B : B ->{ x: a, 0: b } : { [x: string]: A; [x: number]: B; 0: B; x: A; } +>{ x: a, 0: b } : { [x: string]: A | B; [x: number]: B; 0: B; x: A; } >x : A >a : A >b : B diff --git a/tests/baselines/reference/parenthesizedContexualTyping1.types b/tests/baselines/reference/parenthesizedContexualTyping1.types index b7307eaf3e7..f3dc60468d3 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping1.types +++ b/tests/baselines/reference/parenthesizedContexualTyping1.types @@ -149,8 +149,8 @@ var i = fun((Math.random() < 0.5 ? x => x : x => undefined), 10); >i : any >fun((Math.random() < 0.5 ? x => x : x => undefined), 10) : any >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? x => x : x => undefined) : (x: number) => any ->Math.random() < 0.5 ? x => x : x => undefined : (x: number) => any +>(Math.random() < 0.5 ? x => x : x => undefined) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? x => x : x => undefined : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -169,8 +169,8 @@ var j = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10); >j : any >fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10) : any >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => x) : (x => undefined)) : (x: number) => any ->Math.random() < 0.5 ? (x => x) : (x => undefined) : (x: number) => any +>(Math.random() < 0.5 ? (x => x) : (x => undefined)) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? (x => x) : (x => undefined) : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -191,8 +191,8 @@ var k = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10); >k : any >fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10) : any >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => x) : (x => undefined)) : (x: number) => any ->Math.random() < 0.5 ? (x => x) : (x => undefined) : (x: number) => any +>(Math.random() < 0.5 ? (x => x) : (x => undefined)) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? (x => x) : (x => undefined) : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -216,9 +216,9 @@ var l = fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x) >l : any >fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x)), 10) : any >fun : { (g: (x: T) => T, x: T): T; (g: (x: T) => T, h: (y: T) => T, x: T): T; } ->((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))) : (x: number) => any ->(Math.random() < 0.5 ? ((x => x)) : ((x => undefined))) : (x: number) => any ->Math.random() < 0.5 ? ((x => x)) : ((x => undefined)) : (x: number) => any +>((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))) : ((x: number) => number) | ((x: number) => any) +>(Math.random() < 0.5 ? ((x => x)) : ((x => undefined))) : ((x: number) => number) | ((x: number) => any) +>Math.random() < 0.5 ? ((x => x)) : ((x => undefined)) : ((x: number) => number) | ((x: number) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.types b/tests/baselines/reference/parenthesizedContexualTyping2.types index a055f2f1bbd..344933ea1fc 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.types +++ b/tests/baselines/reference/parenthesizedContexualTyping2.types @@ -186,8 +186,8 @@ var i = fun((Math.random() < 0.5 ? x => { x(undefined); return x; } : x >i : number >fun((Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined : (x: (p: T) => T) => any +>(Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? x => { x(undefined); return x; } : x => undefined : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -209,8 +209,8 @@ var j = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >j : number >fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : (x: (p: T) => T) => any +>(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -234,8 +234,8 @@ var k = fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : >k : number >fun((Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)), x => { x(undefined); return x; }, 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : (x: (p: T) => T) => any +>(Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? (x => { x(undefined); return x; }) : (x => undefined) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number @@ -265,9 +265,9 @@ var l = fun(((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) >l : number >fun(((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))),((x => { x(undefined); return x; })), 10) : number >fun : { (f: (x: (p: T) => T) => (p: T) => T, x: T): T; (f: (x: (p: T) => T) => (p: T) => T, g: (x: (p: T) => T) => (p: T) => T, x: T): T; } ->((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))) : (x: (p: T) => T) => any ->(Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined))) : (x: (p: T) => T) => any ->Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)) : (x: (p: T) => T) => any +>((Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)))) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>(Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined))) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) +>Math.random() < 0.5 ? ((x => { x(undefined); return x; })) : ((x => undefined)) : ((x: (p: T) => T) => (p: T) => T) | ((x: (p: T) => T) => any) >Math.random() < 0.5 : boolean >Math.random() : number >Math.random : () => number diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index e3dfd6133c9..c8875d99b63 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); 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 | 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; }'. Index signatures are incompatible. - Type 'string | number | MyString | (() => void)' is not assignable to type 'string'. + Type 'string | number | MyString | (() => void) | (() => 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); 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 | 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: Index signatures are incompatible. -!!! error TS2322: Type 'string | number | MyString | (() => void)' is not assignable to type 'string'. +!!! error TS2322: Type 'string | number | MyString | (() => void) | (() => 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/stringIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt index faef7905453..13d5adcf1f5 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.errors.txt @@ -4,10 +4,11 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A | typeof B; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. Index signatures are incompatible. - Type 'typeof A' is not assignable to type 'A'. - Property 'foo' is missing in type 'typeof A'. + Type 'typeof A | typeof B' is not assignable to type 'A'. + Type 'typeof A' is not assignable to type 'A'. + Property 'foo' is missing in type 'typeof A'. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts (7 errors) ==== @@ -60,10 +61,11 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: A } = { ~ -!!! error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. +!!! error TS2322: Type '{ [x: string]: typeof A | typeof B; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'. !!! error TS2322: Index signatures are incompatible. -!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. -!!! error TS2322: Property 'foo' is missing in type 'typeof A'. +!!! error TS2322: Type 'typeof A | typeof B' is not assignable to type 'A'. +!!! error TS2322: Type 'typeof A' is not assignable to type 'A'. +!!! error TS2322: Property 'foo' is missing in type 'typeof A'. a: A, b: B } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.types b/tests/baselines/reference/subtypingWithCallSignatures2.types index 8a56e05a9c2..ce7918c7627 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.types +++ b/tests/baselines/reference/subtypingWithCallSignatures2.types @@ -331,14 +331,14 @@ 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[])[] ->[r1arg2, r1arg1] : ((x: T) => T[])[] +>r1a : (((x: T) => T[]) | ((x: number) => number[]))[] +>[r1arg2, r1arg1] : (((x: T) => T[]) | ((x: number) => number[]))[] >r1arg2 : (x: number) => number[] >r1arg1 : (x: T) => T[] var r1b = [r1arg1, r1arg2]; // generic signature, subtype in both directions ->r1b : ((x: T) => T[])[] ->[r1arg1, r1arg2] : ((x: T) => T[])[] +>r1b : (((x: T) => T[]) | ((x: number) => number[]))[] +>[r1arg1, r1arg2] : (((x: T) => T[]) | ((x: number) => number[]))[] >r1arg1 : (x: T) => T[] >r1arg2 : (x: number) => number[] @@ -365,14 +365,14 @@ var r2 = foo2(r2arg1); >r2arg1 : (x: T) => string[] var r2a = [r2arg1, r2arg2]; ->r2a : ((x: T) => string[])[] ->[r2arg1, r2arg2] : ((x: T) => string[])[] +>r2a : (((x: T) => string[]) | ((x: number) => string[]))[] +>[r2arg1, r2arg2] : (((x: T) => string[]) | ((x: number) => string[]))[] >r2arg1 : (x: T) => string[] >r2arg2 : (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : ((x: T) => string[])[] ->[r2arg2, r2arg1] : ((x: T) => string[])[] +>r2b : (((x: T) => string[]) | ((x: number) => string[]))[] +>[r2arg2, r2arg1] : (((x: T) => string[]) | ((x: number) => string[]))[] >r2arg2 : (x: number) => string[] >r2arg1 : (x: T) => string[] @@ -396,14 +396,14 @@ var r3 = foo3(r3arg1); >r3arg1 : (x: T) => T var r3a = [r3arg1, r3arg2]; ->r3a : ((x: T) => T)[] ->[r3arg1, r3arg2] : ((x: T) => T)[] +>r3a : (((x: T) => T) | ((x: number) => void))[] +>[r3arg1, r3arg2] : (((x: T) => T) | ((x: number) => void))[] >r3arg1 : (x: T) => T >r3arg2 : (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : ((x: T) => T)[] ->[r3arg2, r3arg1] : ((x: T) => T)[] +>r3b : (((x: T) => T) | ((x: number) => void))[] +>[r3arg2, r3arg1] : (((x: T) => T) | ((x: number) => void))[] >r3arg2 : (x: number) => void >r3arg1 : (x: T) => T @@ -432,14 +432,14 @@ var r4 = foo4(r4arg1); // any >r4arg1 : (x: T, y: U) => T var r4a = [r4arg1, r4arg2]; ->r4a : ((x: T, y: U) => T)[] ->[r4arg1, r4arg2] : ((x: T, y: U) => T)[] +>r4a : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] +>[r4arg1, r4arg2] : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] >r4arg1 : (x: T, y: U) => T >r4arg2 : (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : ((x: T, y: U) => T)[] ->[r4arg2, r4arg1] : ((x: T, y: U) => T)[] +>r4b : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] +>[r4arg2, r4arg1] : (((x: T, y: U) => T) | ((x: string, y: number) => string))[] >r4arg2 : (x: string, y: number) => string >r4arg1 : (x: T, y: U) => T @@ -470,14 +470,14 @@ var r5 = foo5(r5arg1); // any >r5arg1 : (x: (arg: T) => U) => T var r5a = [r5arg1, r5arg2]; ->r5a : ((x: (arg: T) => U) => T)[] ->[r5arg1, r5arg2] : ((x: (arg: T) => U) => T)[] +>r5a : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] +>[r5arg1, r5arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] >r5arg1 : (x: (arg: T) => U) => T >r5arg2 : (x: (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : ((x: (arg: T) => U) => T)[] ->[r5arg2, r5arg1] : ((x: (arg: T) => U) => T)[] +>r5b : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] +>[r5arg2, r5arg1] : (((x: (arg: T) => U) => T) | ((x: (arg: string) => number) => string))[] >r5arg2 : (x: (arg: string) => number) => string >r5arg1 : (x: (arg: T) => U) => T @@ -514,14 +514,14 @@ var r6 = foo6(r6arg1); // any >r6arg1 : (x: (arg: T) => U) => T var r6a = [r6arg1, r6arg2]; ->r6a : ((x: (arg: T) => U) => T)[] ->[r6arg1, r6arg2] : ((x: (arg: T) => U) => T)[] +>r6a : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] +>[r6arg1, r6arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] >r6arg1 : (x: (arg: T) => U) => T >r6arg2 : (x: (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : ((x: (arg: T) => U) => T)[] ->[r6arg2, r6arg1] : ((x: (arg: T) => U) => T)[] +>r6b : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] +>[r6arg2, r6arg1] : (((x: (arg: T) => U) => T) | ((x: (arg: Base) => Derived) => Base))[] >r6arg2 : (x: (arg: Base) => Derived) => Base >r6arg1 : (x: (arg: T) => U) => T @@ -564,14 +564,14 @@ var r7 = foo7(r7arg1); // any >r7arg1 : (x: (arg: T) => U) => (r: T) => U var r7a = [r7arg1, r7arg2]; ->r7a : ((x: (arg: T) => U) => (r: T) => U)[] ->[r7arg1, r7arg2] : ((x: (arg: T) => U) => (r: T) => U)[] +>r7a : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] +>[r7arg1, r7arg2] : (((x: (arg: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived) => (r: Base) => Derived))[] >r7arg1 : (x: (arg: T) => U) => (r: T) => U >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived var r7b = [r7arg2, r7arg1]; ->r7b : ((x: (arg: T) => U) => (r: T) => U)[] ->[r7arg2, r7arg1] : ((x: (arg: T) => U) => (r: T) => U)[] +>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))[] >r7arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived >r7arg1 : (x: (arg: T) => U) => (r: T) => U @@ -622,14 +622,14 @@ var r8 = foo8(r8arg1); // any >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U var r8a = [r8arg1, r8arg2]; ->r8a : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] ->[r8arg1, r8arg2] : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] +>r8a : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] +>[r8arg1, r8arg2] : (((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U) | ((x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived))[] >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U >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)[] ->[r8arg2, r8arg1] : ((x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U)[] +>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))[] >r8arg2 : (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived >r8arg1 : (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U @@ -681,14 +681,14 @@ var r9 = foo9(r9arg1); // any >r9arg1 : (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U var r9a = [r9arg1, r9arg2]; ->r9a : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] ->[r9arg1, r9arg2] : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] +>r9a : (((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))[] +>[r9arg1, r9arg2] : (((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))[] >r9arg1 : (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 var r9b = [r9arg2, r9arg1]; ->r9b : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] ->[r9arg2, r9arg1] : ((x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U)[] +>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))[] >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 @@ -719,14 +719,14 @@ var r10 = foo10(r10arg1); // any >r10arg1 : (...x: T[]) => T var r10a = [r10arg1, r10arg2]; ->r10a : ((...x: T[]) => T)[] ->[r10arg1, r10arg2] : ((...x: T[]) => T)[] +>r10a : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] +>[r10arg1, r10arg2] : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] >r10arg1 : (...x: T[]) => T >r10arg2 : (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : ((...x: T[]) => T)[] ->[r10arg2, r10arg1] : ((...x: T[]) => T)[] +>r10b : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] +>[r10arg2, r10arg1] : (((...x: T[]) => T) | ((...x: Derived[]) => Derived))[] >r10arg2 : (...x: Derived[]) => Derived >r10arg1 : (...x: T[]) => T @@ -760,14 +760,14 @@ var r11 = foo11(r11arg1); // any >r11arg1 : (x: T, y: T) => T var r11a = [r11arg1, r11arg2]; ->r11a : ((x: T, y: T) => T)[] ->[r11arg1, r11arg2] : ((x: T, y: T) => T)[] +>r11a : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r11arg1, r11arg2] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r11arg1 : (x: T, y: T) => T >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : ((x: T, y: T) => T)[] ->[r11arg2, r11arg1] : ((x: T, y: T) => T)[] +>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))[] >r11arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : (x: T, y: T) => T @@ -808,14 +808,14 @@ var r12 = foo12(r12arg1); // any >r12arg1 : (x: Base[], y: T) => Derived[] var r12a = [r12arg1, r12arg2]; ->r12a : ((x: Base[], y: T) => Derived[])[] ->[r12arg1, r12arg2] : ((x: Base[], y: T) => Derived[])[] +>r12a : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>[r12arg1, r12arg2] : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] >r12arg1 : (x: Base[], y: T) => Derived[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : ((x: Base[], y: T) => Derived[])[] ->[r12arg2, r12arg1] : ((x: Base[], y: T) => Derived[])[] +>r12b : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] +>[r12arg2, r12arg1] : (((x: Base[], y: T) => Derived[]) | ((x: Base[], y: Derived2[]) => Derived[]))[] >r12arg2 : (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : (x: Base[], y: T) => Derived[] @@ -853,14 +853,14 @@ var r13 = foo13(r13arg1); // any >r13arg1 : (x: Base[], y: T) => T var r13a = [r13arg1, r13arg2]; ->r13a : ((x: Base[], y: T) => T)[] ->[r13arg1, r13arg2] : ((x: Base[], y: T) => T)[] +>r13a : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] +>[r13arg1, r13arg2] : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] >r13arg1 : (x: Base[], y: T) => T >r13arg2 : (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : ((x: Base[], y: T) => T)[] ->[r13arg2, r13arg1] : ((x: Base[], y: T) => T)[] +>r13b : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] +>[r13arg2, r13arg1] : (((x: Base[], y: T) => T) | ((x: Base[], y: Derived[]) => Derived[]))[] >r13arg2 : (x: Base[], y: Derived[]) => Derived[] >r13arg1 : (x: Base[], y: T) => T @@ -894,14 +894,14 @@ var r14 = foo14(r14arg1); // any >r14arg1 : (x: { a: T; b: T; }) => T var r14a = [r14arg1, r14arg2]; ->r14a : ((x: { a: T; b: T; }) => T)[] ->[r14arg1, r14arg2] : ((x: { a: T; b: T; }) => T)[] +>r14a : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] +>[r14arg1, r14arg2] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => Object))[] >r14arg1 : (x: { a: T; b: T; }) => T >r14arg2 : (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : ((x: { a: T; b: T; }) => T)[] ->[r14arg2, r14arg1] : ((x: { a: T; b: T; }) => T)[] +>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))[] >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 379810b2541..a78d68b1ced 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.types +++ b/tests/baselines/reference/subtypingWithCallSignatures3.types @@ -219,8 +219,8 @@ module Errors { >null : null var r1a = [(x: number) => [''], (x: T) => null]; ->r1a : ((x: T) => U[])[] ->[(x: number) => [''], (x: T) => null] : ((x: T) => U[])[] +>r1a : (((x: number) => string[]) | ((x: T) => U[]))[] +>[(x: number) => [''], (x: T) => null] : (((x: number) => string[]) | ((x: T) => U[]))[] >(x: number) => [''] : (x: number) => string[] >x : number >[''] : string[] @@ -235,8 +235,8 @@ module Errors { >null : null var r1b = [(x: T) => null, (x: number) => ['']]; ->r1b : ((x: T) => U[])[] ->[(x: T) => null, (x: number) => ['']] : ((x: T) => U[])[] +>r1b : (((x: T) => U[]) | ((x: number) => string[]))[] +>[(x: T) => null, (x: number) => ['']] : (((x: T) => U[]) | ((x: number) => string[]))[] >(x: T) => null : (x: T) => U[] >T : T >U : U @@ -291,14 +291,14 @@ module Errors { >r2arg : (x: (arg: T) => U) => (r: T) => V var r2a = [r2arg2, r2arg]; ->r2a : ((x: (arg: T) => U) => (r: T) => V)[] ->[r2arg2, r2arg] : ((x: (arg: T) => U) => (r: T) => V)[] +>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))[] >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 >r2arg : (x: (arg: T) => U) => (r: T) => V var r2b = [r2arg, r2arg2]; ->r2b : ((x: (arg: T) => U) => (r: T) => V)[] ->[r2arg, r2arg2] : ((x: (arg: T) => U) => (r: T) => V)[] +>r2b : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] +>[r2arg, r2arg2] : (((x: (arg: T) => U) => (r: T) => V) | ((x: (arg: Base) => Derived) => (r: Base) => Derived2))[] >r2arg : (x: (arg: T) => U) => (r: T) => V >r2arg2 : (x: (arg: Base) => Derived) => (r: Base) => Derived2 @@ -387,14 +387,14 @@ module Errors { >r4arg : (...x: T[]) => T var r4a = [r4arg2, r4arg]; ->r4a : ((...x: T[]) => T)[] ->[r4arg2, r4arg] : ((...x: T[]) => T)[] +>r4a : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] +>[r4arg2, r4arg] : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] >r4arg2 : (...x: Base[]) => Base >r4arg : (...x: T[]) => T var r4b = [r4arg, r4arg2]; ->r4b : ((...x: T[]) => T)[] ->[r4arg, r4arg2] : ((...x: T[]) => T)[] +>r4b : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] +>[r4arg, r4arg2] : (((...x: T[]) => T) | ((...x: Base[]) => Base))[] >r4arg : (...x: T[]) => T >r4arg2 : (...x: Base[]) => Base @@ -430,14 +430,14 @@ module Errors { >r5arg : (x: T, y: T) => T var r5a = [r5arg2, r5arg]; ->r5a : ((x: T, y: T) => T)[] ->[r5arg2, r5arg] : ((x: T, y: T) => T)[] +>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))[] >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg : (x: T, y: T) => T var r5b = [r5arg, r5arg2]; ->r5b : ((x: T, y: T) => T)[] ->[r5arg, r5arg2] : ((x: T, y: T) => T)[] +>r5b : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r5arg, r5arg2] : (((x: T, y: T) => T) | ((x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r5arg : (x: T, y: T) => T >r5arg2 : (x: { foo: string; }, y: { foo: string; bar: string; }) => Base @@ -478,14 +478,14 @@ module Errors { >r6arg : (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg]; ->r6a : ((x: Base[], y: Base[]) => T)[] ->[r6arg2, r6arg] : ((x: Base[], y: Base[]) => T)[] +>r6a : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] +>[r6arg2, r6arg] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] >r6arg2 : (x: Base[], y: Base[]) => T >r6arg : (x: Base[], y: Derived2[]) => Derived[] var r6b = [r6arg, r6arg2]; ->r6b : ((x: Base[], y: Base[]) => T)[] ->[r6arg, r6arg2] : ((x: Base[], y: Base[]) => T)[] +>r6b : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] +>[r6arg, r6arg2] : (((x: Base[], y: Derived2[]) => Derived[]) | ((x: Base[], y: Base[]) => T))[] >r6arg : (x: Base[], y: Derived2[]) => Derived[] >r6arg2 : (x: Base[], y: Base[]) => T @@ -517,14 +517,14 @@ module Errors { >r7arg : (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg]; ->r7a : ((x: { a: T; b: T; }) => T)[] ->[r7arg2, r7arg] : ((x: { a: T; b: T; }) => T)[] +>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))[] >r7arg2 : (x: { a: string; b: number; }) => number >r7arg : (x: { a: T; b: T; }) => T var r7b = [r7arg, r7arg2]; ->r7b : ((x: { a: T; b: T; }) => T)[] ->[r7arg, r7arg2] : ((x: { a: T; b: T; }) => T)[] +>r7b : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] +>[r7arg, r7arg2] : (((x: { a: T; b: T; }) => T) | ((x: { a: string; b: number; }) => number))[] >r7arg : (x: { a: T; b: T; }) => T >r7arg2 : (x: { a: string; b: number; }) => number @@ -547,14 +547,14 @@ module Errors { >r7arg3 : (x: { a: T; b: T; }) => number var r7d = [r7arg2, r7arg3]; ->r7d : ((x: { a: string; b: number; }) => number)[] ->[r7arg2, r7arg3] : ((x: { a: string; b: number; }) => number)[] +>r7d : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] +>[r7arg2, r7arg3] : (((x: { a: string; b: number; }) => number) | ((x: { a: T; b: T; }) => number))[] >r7arg2 : (x: { a: string; b: number; }) => number >r7arg3 : (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : ((x: { a: string; b: number; }) => number)[] ->[r7arg3, r7arg2] : ((x: { a: string; b: number; }) => number)[] +>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))[] >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 e76d36114e9..1ba6348acd2 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.types +++ b/tests/baselines/reference/subtypingWithCallSignatures4.types @@ -317,14 +317,14 @@ var r3 = foo3(r3arg); >r3arg : (x: T) => T var r3a = [r3arg, r3arg2]; ->r3a : ((x: T) => T)[] ->[r3arg, r3arg2] : ((x: T) => T)[] +>r3a : (((x: T) => T) | ((x: T) => void))[] +>[r3arg, r3arg2] : (((x: T) => T) | ((x: T) => void))[] >r3arg : (x: T) => T >r3arg2 : (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : ((x: T) => T)[] ->[r3arg2, r3arg] : ((x: T) => T)[] +>r3b : (((x: T) => T) | ((x: T) => void))[] +>[r3arg2, r3arg] : (((x: T) => T) | ((x: T) => void))[] >r3arg2 : (x: T) => void >r3arg : (x: T) => T @@ -447,14 +447,14 @@ var r6 = foo6(r6arg); >r6arg : (x: (arg: T) => U) => T var r6a = [r6arg, r6arg2]; ->r6a : ((x: (arg: T) => U) => T)[] ->[r6arg, r6arg2] : ((x: (arg: T) => U) => T)[] +>r6a : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] +>[r6arg, r6arg2] : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] >r6arg : (x: (arg: T) => U) => T >r6arg2 : (x: (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : ((x: (arg: T) => U) => T)[] ->[r6arg2, r6arg] : ((x: (arg: T) => U) => T)[] +>r6b : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] +>[r6arg2, r6arg] : (((x: (arg: T) => U) => T) | ((x: (arg: T) => Derived) => T))[] >r6arg2 : (x: (arg: T) => Derived) => T >r6arg : (x: (arg: T) => U) => T @@ -498,14 +498,14 @@ var r11 = foo11(r11arg); >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base var r11a = [r11arg, r11arg2]; ->r11a : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] ->[r11arg, r11arg2] : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>r11a : (((x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>[r11arg, r11arg2] : (((x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | ((x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base var r11b = [r11arg2, r11arg]; ->r11b : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] ->[r11arg2, r11arg] : ((x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>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))[] >r11arg2 : (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -543,14 +543,14 @@ var r15 = foo15(r15arg); >r15arg : (x: { a: U; b: V; }) => U[] var r15a = [r15arg, r15arg2]; ->r15a : ((x: { a: U; b: V; }) => U[])[] ->[r15arg, r15arg2] : ((x: { a: U; b: V; }) => U[])[] +>r15a : (((x: { a: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] +>[r15arg, r15arg2] : (((x: { a: U; b: V; }) => U[]) | ((x: { a: T; b: T; }) => T[]))[] >r15arg : (x: { a: U; b: V; }) => U[] >r15arg2 : (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : ((x: { a: U; b: V; }) => U[])[] ->[r15arg2, r15arg] : ((x: { a: U; b: V; }) => U[])[] +>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[]))[] >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 d723a367ecb..e8ff518215f 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.types @@ -326,14 +326,14 @@ 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[])[] ->[r1arg2, r1arg1] : (new (x: T) => T[])[] +>r1a : ((new (x: T) => T[]) | (new (x: number) => number[]))[] +>[r1arg2, r1arg1] : ((new (x: T) => T[]) | (new (x: number) => number[]))[] >r1arg2 : new (x: number) => number[] >r1arg1 : new (x: T) => T[] var r1b = [r1arg1, r1arg2]; // generic signature, subtype in both directions ->r1b : (new (x: T) => T[])[] ->[r1arg1, r1arg2] : (new (x: T) => T[])[] +>r1b : ((new (x: T) => T[]) | (new (x: number) => number[]))[] +>[r1arg1, r1arg2] : ((new (x: T) => T[]) | (new (x: number) => number[]))[] >r1arg1 : new (x: T) => T[] >r1arg2 : new (x: number) => number[] @@ -354,14 +354,14 @@ var r2 = foo2(r2arg1); >r2arg1 : new (x: T) => string[] var r2a = [r2arg1, r2arg2]; ->r2a : (new (x: T) => string[])[] ->[r2arg1, r2arg2] : (new (x: T) => string[])[] +>r2a : ((new (x: T) => string[]) | (new (x: number) => string[]))[] +>[r2arg1, r2arg2] : ((new (x: T) => string[]) | (new (x: number) => string[]))[] >r2arg1 : new (x: T) => string[] >r2arg2 : new (x: number) => string[] var r2b = [r2arg2, r2arg1]; ->r2b : (new (x: T) => string[])[] ->[r2arg2, r2arg1] : (new (x: T) => string[])[] +>r2b : ((new (x: T) => string[]) | (new (x: number) => string[]))[] +>[r2arg2, r2arg1] : ((new (x: T) => string[]) | (new (x: number) => string[]))[] >r2arg2 : new (x: number) => string[] >r2arg1 : new (x: T) => string[] @@ -383,14 +383,14 @@ var r3 = foo3(r3arg1); >r3arg1 : new (x: T) => T var r3a = [r3arg1, r3arg2]; ->r3a : (new (x: T) => T)[] ->[r3arg1, r3arg2] : (new (x: T) => T)[] +>r3a : ((new (x: T) => T) | (new (x: number) => void))[] +>[r3arg1, r3arg2] : ((new (x: T) => T) | (new (x: number) => void))[] >r3arg1 : new (x: T) => T >r3arg2 : new (x: number) => void var r3b = [r3arg2, r3arg1]; ->r3b : (new (x: T) => T)[] ->[r3arg2, r3arg1] : (new (x: T) => T)[] +>r3b : ((new (x: T) => T) | (new (x: number) => void))[] +>[r3arg2, r3arg1] : ((new (x: T) => T) | (new (x: number) => void))[] >r3arg2 : new (x: number) => void >r3arg1 : new (x: T) => T @@ -416,14 +416,14 @@ var r4 = foo4(r4arg1); // any >r4arg1 : new (x: T, y: U) => T var r4a = [r4arg1, r4arg2]; ->r4a : (new (x: T, y: U) => T)[] ->[r4arg1, r4arg2] : (new (x: T, y: U) => T)[] +>r4a : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] +>[r4arg1, r4arg2] : ((new (x: T, y: U) => T) | (new (x: string, y: number) => string))[] >r4arg1 : new (x: T, y: U) => T >r4arg2 : new (x: string, y: number) => string var r4b = [r4arg2, r4arg1]; ->r4b : (new (x: T, y: U) => T)[] ->[r4arg2, r4arg1] : (new (x: T, y: U) => T)[] +>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))[] >r4arg2 : new (x: string, y: number) => string >r4arg1 : new (x: T, y: U) => T @@ -449,14 +449,14 @@ var r5 = foo5(r5arg1); // any >r5arg1 : new (x: new (arg: T) => U) => T var r5a = [r5arg1, r5arg2]; ->r5a : (new (x: new (arg: T) => U) => T)[] ->[r5arg1, r5arg2] : (new (x: new (arg: T) => U) => T)[] +>r5a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] +>[r5arg1, r5arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: string) => number) => string))[] >r5arg1 : new (x: new (arg: T) => U) => T >r5arg2 : new (x: new (arg: string) => number) => string var r5b = [r5arg2, r5arg1]; ->r5b : (new (x: new (arg: T) => U) => T)[] ->[r5arg2, r5arg1] : (new (x: new (arg: T) => U) => T)[] +>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))[] >r5arg2 : new (x: new (arg: string) => number) => string >r5arg1 : new (x: new (arg: T) => U) => T @@ -487,14 +487,14 @@ var r6 = foo6(r6arg1); // any >r6arg1 : new (x: new (arg: T) => U) => T var r6a = [r6arg1, r6arg2]; ->r6a : (new (x: new (arg: T) => U) => T)[] ->[r6arg1, r6arg2] : (new (x: new (arg: T) => U) => T)[] +>r6a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] +>[r6arg1, r6arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: Base) => Derived) => Base))[] >r6arg1 : new (x: new (arg: T) => U) => T >r6arg2 : new (x: new (arg: Base) => Derived) => Base var r6b = [r6arg2, r6arg1]; ->r6b : (new (x: new (arg: T) => U) => T)[] ->[r6arg2, r6arg1] : (new (x: new (arg: T) => U) => T)[] +>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))[] >r6arg2 : new (x: new (arg: Base) => Derived) => Base >r6arg1 : new (x: new (arg: T) => U) => T @@ -529,14 +529,14 @@ var r7 = foo7(r7arg1); // any >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U var r7a = [r7arg1, r7arg2]; ->r7a : (new (x: new (arg: T) => U) => new (r: T) => U)[] ->[r7arg1, r7arg2] : (new (x: new (arg: T) => U) => new (r: T) => U)[] +>r7a : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] +>[r7arg1, r7arg2] : ((new (x: new (arg: T) => U) => new (r: T) => U) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived))[] >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U >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)[] ->[r7arg2, r7arg1] : (new (x: new (arg: T) => U) => new (r: T) => U)[] +>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))[] >r7arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived >r7arg1 : new (x: new (arg: T) => U) => new (r: T) => U @@ -579,14 +579,14 @@ var r8 = foo8(r8arg1); // any >r8arg1 : new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U var r8a = [r8arg1, r8arg2]; ->r8a : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] ->[r8arg1, r8arg2] : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] +>r8a : ((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))[] +>[r8arg1, r8arg2] : ((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))[] >r8arg1 : 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 var r8b = [r8arg2, r8arg1]; ->r8b : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] ->[r8arg2, r8arg1] : (new (x: new (arg: T) => U, y: new (arg2: T) => U) => new (r: T) => U)[] +>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))[] >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 @@ -662,14 +662,14 @@ var r10 = foo10(r10arg1); // any >r10arg1 : new (...x: T[]) => T var r10a = [r10arg1, r10arg2]; ->r10a : (new (...x: T[]) => T)[] ->[r10arg1, r10arg2] : (new (...x: T[]) => T)[] +>r10a : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] +>[r10arg1, r10arg2] : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] >r10arg1 : new (...x: T[]) => T >r10arg2 : new (...x: Derived[]) => Derived var r10b = [r10arg2, r10arg1]; ->r10b : (new (...x: T[]) => T)[] ->[r10arg2, r10arg1] : (new (...x: T[]) => T)[] +>r10b : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] +>[r10arg2, r10arg1] : ((new (...x: T[]) => T) | (new (...x: Derived[]) => Derived))[] >r10arg2 : new (...x: Derived[]) => Derived >r10arg1 : new (...x: T[]) => T @@ -699,14 +699,14 @@ var r11 = foo11(r11arg1); // any >r11arg1 : new (x: T, y: T) => T var r11a = [r11arg1, r11arg2]; ->r11a : (new (x: T, y: T) => T)[] ->[r11arg1, r11arg2] : (new (x: T, y: T) => T)[] +>r11a : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r11arg1, r11arg2] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r11arg1 : new (x: T, y: T) => T >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base var r11b = [r11arg2, r11arg1]; ->r11b : (new (x: T, y: T) => T)[] ->[r11arg2, r11arg1] : (new (x: T, y: T) => T)[] +>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))[] >r11arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r11arg1 : new (x: T, y: T) => T @@ -741,14 +741,14 @@ var r12 = foo12(r12arg1); // any >r12arg1 : new (x: Base[], y: T) => Derived[] var r12a = [r12arg1, r12arg2]; ->r12a : (new (x: Base[], y: T) => Derived[])[] ->[r12arg1, r12arg2] : (new (x: Base[], y: T) => Derived[])[] +>r12a : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] +>[r12arg1, r12arg2] : ((new (x: Base[], y: T) => Derived[]) | (new (x: Base[], y: Derived2[]) => Derived[]))[] >r12arg1 : new (x: Base[], y: T) => Derived[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] var r12b = [r12arg2, r12arg1]; ->r12b : (new (x: Base[], y: T) => Derived[])[] ->[r12arg2, r12arg1] : (new (x: Base[], y: T) => Derived[])[] +>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[]))[] >r12arg2 : new (x: Base[], y: Derived2[]) => Derived[] >r12arg1 : new (x: Base[], y: T) => Derived[] @@ -782,14 +782,14 @@ var r13 = foo13(r13arg1); // any >r13arg1 : new (x: Base[], y: T) => T var r13a = [r13arg1, r13arg2]; ->r13a : (new (x: Base[], y: T) => T)[] ->[r13arg1, r13arg2] : (new (x: Base[], y: T) => T)[] +>r13a : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] +>[r13arg1, r13arg2] : ((new (x: Base[], y: T) => T) | (new (x: Base[], y: Derived[]) => Derived[]))[] >r13arg1 : new (x: Base[], y: T) => T >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] var r13b = [r13arg2, r13arg1]; ->r13b : (new (x: Base[], y: T) => T)[] ->[r13arg2, r13arg1] : (new (x: Base[], y: T) => T)[] +>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[]))[] >r13arg2 : new (x: Base[], y: Derived[]) => Derived[] >r13arg1 : new (x: Base[], y: T) => T @@ -817,14 +817,14 @@ var r14 = foo14(r14arg1); // any >r14arg1 : new (x: { a: T; b: T; }) => T var r14a = [r14arg1, r14arg2]; ->r14a : (new (x: { a: T; b: T; }) => T)[] ->[r14arg1, r14arg2] : (new (x: { a: T; b: T; }) => T)[] +>r14a : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] +>[r14arg1, r14arg2] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => Object))[] >r14arg1 : new (x: { a: T; b: T; }) => T >r14arg2 : new (x: { a: string; b: number; }) => Object var r14b = [r14arg2, r14arg1]; ->r14b : (new (x: { a: T; b: T; }) => T)[] ->[r14arg2, r14arg1] : (new (x: { a: T; b: T; }) => T)[] +>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))[] >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 b0f0680c7a0..63b1e64e541 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.types @@ -224,14 +224,14 @@ module Errors { >r1arg1 : new (x: T) => U[] var r1a = [r1arg2, r1arg1]; ->r1a : (new (x: T) => U[])[] ->[r1arg2, r1arg1] : (new (x: T) => U[])[] +>r1a : ((new (x: T) => U[]) | (new (x: number) => string[]))[] +>[r1arg2, r1arg1] : ((new (x: T) => U[]) | (new (x: number) => string[]))[] >r1arg2 : new (x: number) => string[] >r1arg1 : new (x: T) => U[] var r1b = [r1arg1, r1arg2]; ->r1b : (new (x: T) => U[])[] ->[r1arg1, r1arg2] : (new (x: T) => U[])[] +>r1b : ((new (x: T) => U[]) | (new (x: number) => string[]))[] +>[r1arg1, r1arg2] : ((new (x: T) => U[]) | (new (x: number) => string[]))[] >r1arg1 : new (x: T) => U[] >r1arg2 : new (x: number) => string[] @@ -268,14 +268,14 @@ 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)[] ->[r2arg2, r2arg1] : (new (x: new (arg: T) => U) => new (r: T) => V)[] +>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))[] >r2arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V var r2b = [r2arg1, r2arg2]; ->r2b : (new (x: new (arg: T) => U) => new (r: T) => V)[] ->[r2arg1, r2arg2] : (new (x: new (arg: T) => U) => new (r: T) => V)[] +>r2b : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] +>[r2arg1, r2arg2] : ((new (x: new (arg: T) => U) => new (r: T) => V) | (new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2))[] >r2arg1 : new (x: new (arg: T) => U) => new (r: T) => V >r2arg2 : new (x: new (arg: Base) => Derived) => new (r: Base) => Derived2 @@ -350,14 +350,14 @@ module Errors { >r4arg1 : new (...x: T[]) => T var r4a = [r4arg2, r4arg1]; ->r4a : (new (...x: T[]) => T)[] ->[r4arg2, r4arg1] : (new (...x: T[]) => T)[] +>r4a : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] +>[r4arg2, r4arg1] : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] >r4arg2 : new (...x: Base[]) => Base >r4arg1 : new (...x: T[]) => T var r4b = [r4arg1, r4arg2]; ->r4b : (new (...x: T[]) => T)[] ->[r4arg1, r4arg2] : (new (...x: T[]) => T)[] +>r4b : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] +>[r4arg1, r4arg2] : ((new (...x: T[]) => T) | (new (...x: Base[]) => Base))[] >r4arg1 : new (...x: T[]) => T >r4arg2 : new (...x: Base[]) => Base @@ -387,14 +387,14 @@ module Errors { >r5arg1 : new (x: T, y: T) => T var r5a = [r5arg2, r5arg1]; ->r5a : (new (x: T, y: T) => T)[] ->[r5arg2, r5arg1] : (new (x: T, y: T) => T)[] +>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))[] >r5arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base >r5arg1 : new (x: T, y: T) => T var r5b = [r5arg1, r5arg2]; ->r5b : (new (x: T, y: T) => T)[] ->[r5arg1, r5arg2] : (new (x: T, y: T) => T)[] +>r5b : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] +>[r5arg1, r5arg2] : ((new (x: T, y: T) => T) | (new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base))[] >r5arg1 : new (x: T, y: T) => T >r5arg2 : new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base @@ -429,14 +429,14 @@ module Errors { >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] var r6a = [r6arg2, r6arg1]; ->r6a : (new (x: Base[], y: Base[]) => T)[] ->[r6arg2, r6arg1] : (new (x: Base[], y: Base[]) => T)[] +>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))[] >r6arg2 : new (x: Base[], y: Base[]) => T >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] var r6b = [r6arg1, r6arg2]; ->r6b : (new (x: Base[], y: Base[]) => T)[] ->[r6arg1, r6arg2] : (new (x: Base[], y: Base[]) => T)[] +>r6b : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] +>[r6arg1, r6arg2] : ((new (x: Base[], y: Derived2[]) => Derived[]) | (new (x: Base[], y: Base[]) => T))[] >r6arg1 : new (x: Base[], y: Derived2[]) => Derived[] >r6arg2 : new (x: Base[], y: Base[]) => T @@ -463,14 +463,14 @@ module Errors { >r7arg1 : new (x: { a: T; b: T; }) => T var r7a = [r7arg2, r7arg1]; ->r7a : (new (x: { a: T; b: T; }) => T)[] ->[r7arg2, r7arg1] : (new (x: { a: T; b: T; }) => T)[] +>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))[] >r7arg2 : new (x: { a: string; b: number; }) => number >r7arg1 : new (x: { a: T; b: T; }) => T var r7b = [r7arg1, r7arg2]; ->r7b : (new (x: { a: T; b: T; }) => T)[] ->[r7arg1, r7arg2] : (new (x: { a: T; b: T; }) => T)[] +>r7b : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] +>[r7arg1, r7arg2] : ((new (x: { a: T; b: T; }) => T) | (new (x: { a: string; b: number; }) => number))[] >r7arg1 : new (x: { a: T; b: T; }) => T >r7arg2 : new (x: { a: string; b: number; }) => number @@ -491,14 +491,14 @@ module Errors { >r7arg3 : new (x: { a: T; b: T; }) => number var r7d = [r7arg2, r7arg3]; ->r7d : (new (x: { a: string; b: number; }) => number)[] ->[r7arg2, r7arg3] : (new (x: { a: string; b: number; }) => number)[] +>r7d : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] +>[r7arg2, r7arg3] : ((new (x: { a: string; b: number; }) => number) | (new (x: { a: T; b: T; }) => number))[] >r7arg2 : new (x: { a: string; b: number; }) => number >r7arg3 : new (x: { a: T; b: T; }) => number var r7e = [r7arg3, r7arg2]; ->r7e : (new (x: { a: string; b: number; }) => number)[] ->[r7arg3, r7arg2] : (new (x: { a: string; b: number; }) => number)[] +>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))[] >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 21a40ecf7fc..bfe07d3b12b 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.types +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.types @@ -301,14 +301,14 @@ var r3 = foo3(r3arg); >r3arg : new (x: T) => T var r3a = [r3arg, r3arg2]; ->r3a : (new (x: T) => T)[] ->[r3arg, r3arg2] : (new (x: T) => T)[] +>r3a : ((new (x: T) => T) | (new (x: T) => void))[] +>[r3arg, r3arg2] : ((new (x: T) => T) | (new (x: T) => void))[] >r3arg : new (x: T) => T >r3arg2 : new (x: T) => void var r3b = [r3arg2, r3arg]; ->r3b : (new (x: T) => T)[] ->[r3arg2, r3arg] : (new (x: T) => T)[] +>r3b : ((new (x: T) => T) | (new (x: T) => void))[] +>[r3arg2, r3arg] : ((new (x: T) => T) | (new (x: T) => void))[] >r3arg2 : new (x: T) => void >r3arg : new (x: T) => T @@ -415,14 +415,14 @@ var r6 = foo6(r6arg); >r6arg : new (x: new (arg: T) => U) => T var r6a = [r6arg, r6arg2]; ->r6a : (new (x: new (arg: T) => U) => T)[] ->[r6arg, r6arg2] : (new (x: new (arg: T) => U) => T)[] +>r6a : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] +>[r6arg, r6arg2] : ((new (x: new (arg: T) => U) => T) | (new (x: new (arg: T) => Derived) => T))[] >r6arg : new (x: new (arg: T) => U) => T >r6arg2 : new (x: new (arg: T) => Derived) => T var r6b = [r6arg2, r6arg]; ->r6b : (new (x: new (arg: T) => U) => T)[] ->[r6arg2, r6arg] : (new (x: new (arg: T) => U) => T)[] +>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))[] >r6arg2 : new (x: new (arg: T) => Derived) => T >r6arg : new (x: new (arg: T) => U) => T @@ -460,14 +460,14 @@ var r11 = foo11(r11arg); >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base var r11a = [r11arg, r11arg2]; ->r11a : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] ->[r11arg, r11arg2] : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>r11a : ((new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] +>[r11arg, r11arg2] : ((new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base) | (new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base))[] >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base >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)[] ->[r11arg2, r11arg] : (new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base)[] +>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))[] >r11arg2 : new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base >r11arg : new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base @@ -499,14 +499,14 @@ var r15 = foo15(r15arg); >r15arg : new (x: { a: U; b: V; }) => U[] var r15a = [r15arg, r15arg2]; ->r15a : (new (x: { a: U; b: V; }) => U[])[] ->[r15arg, r15arg2] : (new (x: { a: U; b: V; }) => U[])[] +>r15a : ((new (x: { a: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] +>[r15arg, r15arg2] : ((new (x: { a: U; b: V; }) => U[]) | (new (x: { a: T; b: T; }) => T[]))[] >r15arg : new (x: { a: U; b: V; }) => U[] >r15arg2 : new (x: { a: T; b: T; }) => T[] var r15b = [r15arg2, r15arg]; ->r15b : (new (x: { a: U; b: V; }) => U[])[] ->[r15arg2, r15arg] : (new (x: { a: U; b: V; }) => U[])[] +>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[]))[] >r15arg2 : new (x: { a: T; b: T; }) => T[] >r15arg : new (x: { a: U; b: V; }) => U[] diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types index 815f2d60740..0d55d78e266 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality.types +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality.types @@ -85,8 +85,8 @@ var b = { Foo: null }; >null : null var r = true ? a : b; ->r : { Foo?: Base; } ->true ? a : b : { Foo?: Base; } +>r : { Foo?: Base; } | { Foo: Derived; } +>true ? a : b : { Foo?: Base; } | { Foo: Derived; } >true : boolean >a : { Foo?: Base; } >b : { Foo: Derived; } @@ -156,8 +156,8 @@ module TwoLevels { >null : null var r = true ? a : b; ->r : { Foo?: Base; } ->true ? a : b : { Foo?: Base; } +>r : { Foo?: Base; } | { Foo: Derived2; } +>true ? a : b : { Foo?: Base; } | { Foo: Derived2; } >true : boolean >a : { Foo?: Base; } >b : { Foo: Derived2; } diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types index 903c4ec0ecc..6ab1349713c 100644 --- a/tests/baselines/reference/symbolType11.types +++ b/tests/baselines/reference/symbolType11.types @@ -33,7 +33,7 @@ s || 1; >1 : number ({}) || s; ->({}) || s : {} +>({}) || s : symbol | {} >({}) : {} >{} : {} >s : symbol diff --git a/tests/baselines/reference/tsxElementResolution9.errors.txt b/tests/baselines/reference/tsxElementResolution9.errors.txt index f4412719b33..64514eebc00 100644 --- a/tests/baselines/reference/tsxElementResolution9.errors.txt +++ b/tests/baselines/reference/tsxElementResolution9.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/jsx/tsxElementResolution9.tsx(11,2): error TS2601: The return type of a JSX element constructor must return an object type. tests/cases/conformance/jsx/tsxElementResolution9.tsx(18,2): error TS2601: The return type of a JSX element constructor must return an object type. +tests/cases/conformance/jsx/tsxElementResolution9.tsx(25,2): error TS2601: The return type of a JSX element constructor must return an object type. -==== tests/cases/conformance/jsx/tsxElementResolution9.tsx (2 errors) ==== +==== tests/cases/conformance/jsx/tsxElementResolution9.tsx (3 errors) ==== declare module JSX { interface Element { } interface IntrinsicElements { } @@ -32,4 +33,6 @@ tests/cases/conformance/jsx/tsxElementResolution9.tsx(18,2): error TS2601: The r } var Obj3: Obj3; ; // OK + ~~~~ +!!! error TS2601: The return type of a JSX element constructor must return an object type. \ No newline at end of file diff --git a/tests/baselines/reference/tupleTypes.errors.txt b/tests/baselines/reference/tupleTypes.errors.txt index d1257be13ef..75f413eb170 100644 --- a/tests/baselines/reference/tupleTypes.errors.txt +++ b/tests/baselines/reference/tupleTypes.errors.txt @@ -14,8 +14,9 @@ tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]' 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. - Type '() => {}' is not assignable to type '() => number'. - Type '{}' is not assignable to type 'number'. + Type '() => number | {}' is not assignable to type '() => number'. + Type 'number | {}' is not assignable to type 'number'. + Type '{}' is not assignable to type 'number'. tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'. Types of property '1' are incompatible. Type 'number' is not assignable to type 'string'. @@ -97,8 +98,9 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n ~ !!! error TS2322: Type '[number, {}]' is not assignable to type 'number[]'. !!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => {}' is not assignable to type '() => number'. -!!! error TS2322: Type '{}' is not assignable to type 'number'. +!!! error TS2322: Type '() => number | {}' is not assignable to type '() => number'. +!!! error TS2322: Type 'number | {}' is not assignable to type 'number'. +!!! error TS2322: Type '{}' is not assignable to type 'number'. a1 = a2; // Error ~~ !!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'. diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.types b/tests/baselines/reference/typeGuardsInConditionalExpression.types index 3965abfe962..1518b605af7 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.types +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.types @@ -363,9 +363,9 @@ function foo12(x: number | string | boolean) { >10 : number >x.toString().length : number >x.toString() : string ->x.toString : (radix?: number) => string +>x.toString : ((radix?: number) => string) | (() => string) >x : string | number | boolean ->toString : (radix?: number) => string +>toString : ((radix?: number) => string) | (() => string) >length : number : ((b = x) // x is number | boolean | string - changed in true branch diff --git a/tests/baselines/reference/typeGuardsInIfStatement.types b/tests/baselines/reference/typeGuardsInIfStatement.types index 59a9ff512af..e682c3da895 100644 --- a/tests/baselines/reference/typeGuardsInIfStatement.types +++ b/tests/baselines/reference/typeGuardsInIfStatement.types @@ -333,9 +333,9 @@ function foo11(x: number | string | boolean) { >10 && x.toString() : string >10 : number >x.toString() : string ->x.toString : () => string +>x.toString : (() => string) | ((radix?: number) => string) >x : string | number | boolean ->toString : () => string +>toString : (() => string) | ((radix?: number) => string) ) : ( @@ -348,9 +348,9 @@ function foo11(x: number | string | boolean) { >x && x.toString() : string >x : string | number | boolean >x.toString() : string ->x.toString : () => string +>x.toString : (() => string) | ((radix?: number) => string) >x : string | number | boolean ->toString : () => string +>toString : (() => string) | ((radix?: number) => string) ); } @@ -369,9 +369,9 @@ function foo12(x: number | string | boolean) { return x.toString(); // string | number | boolean - x changed in else branch >x.toString() : string ->x.toString : () => string +>x.toString : (() => string) | ((radix?: number) => string) >x : string | number | boolean ->toString : () => string +>toString : (() => string) | ((radix?: number) => string) } else { x = 10; diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types index 10b72e3fbd1..a3228352dac 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types @@ -180,9 +180,9 @@ function foo7(x: number | string | boolean) { >10 && x.toString() : string >10 : number >x.toString() : string ->x.toString : () => string +>x.toString : (() => string) | ((radix?: number) => string) >x : string | number | boolean ->toString : () => string +>toString : (() => string) | ((radix?: number) => string) // do not change value : (y = x && x.toString()))); // number | boolean | string @@ -192,9 +192,9 @@ function foo7(x: number | string | boolean) { >x && x.toString() : string >x : string | number | boolean >x.toString() : string ->x.toString : () => string +>x.toString : (() => string) | ((radix?: number) => string) >x : string | number | boolean ->toString : () => string +>toString : (() => string) | ((radix?: number) => string) } function foo8(x: number | string) { >foo8 : (x: string | number) => number diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types index 81160323429..b997189dd0c 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types @@ -180,9 +180,9 @@ function foo7(x: number | string | boolean) { >10 && x.toString() : string >10 : number >x.toString() : string ->x.toString : () => string +>x.toString : (() => string) | ((radix?: number) => string) >x : string | number | boolean ->toString : () => string +>toString : (() => string) | ((radix?: number) => string) // do not change value : (y = x && x.toString()))); // number | boolean | string @@ -192,9 +192,9 @@ function foo7(x: number | string | boolean) { >x && x.toString() : string >x : string | number | boolean >x.toString() : string ->x.toString : () => string +>x.toString : (() => string) | ((radix?: number) => string) >x : string | number | boolean ->toString : () => string +>toString : (() => string) | ((radix?: number) => string) } function foo8(x: number | string) { >foo8 : (x: string | number) => number | boolean diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index 33c282e903c..637467fc0d5 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -547,7 +547,7 @@ _.flatten([1, [2], [3, [[4]]]]); >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } ->[1, [2], [3, [[4]]]] : (number | (number | number[][])[])[] +>[1, [2], [3, [[4]]]] : (number | number[] | (number | number[][])[])[] >1 : number >[2] : number[] >2 : number @@ -562,7 +562,7 @@ _.flatten([1, [2], [3, [[4]]]], true); >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } ->[1, [2], [3, [[4]]]] : (number | (number | number[][])[])[] +>[1, [2], [3, [[4]]]] : (number | number[] | (number | number[][])[])[] >1 : number >[2] : number[] >2 : number diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.types b/tests/baselines/reference/unionTypeFromArrayLiteral.types index 63aefdd214c..604925eb25f 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.types +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.types @@ -83,15 +83,15 @@ var arr6 = [c, d]; // (C | D)[] >d : D var arr7 = [c, d, e]; // (C | D)[] ->arr7 : (C | D)[] ->[c, d, e] : (C | D)[] +>arr7 : (C | D | E)[] +>[c, d, e] : (C | D | E)[] >c : C >d : D >e : E var arr8 = [c, e]; // C[] ->arr8 : C[] ->[c, e] : C[] +>arr8 : (C | E)[] +>[c, e] : (C | E)[] >c : C >e : E diff --git a/tests/baselines/reference/unionTypeReduction.types b/tests/baselines/reference/unionTypeReduction.types index 073d690162a..8ecd9b33fb5 100644 --- a/tests/baselines/reference/unionTypeReduction.types +++ b/tests/baselines/reference/unionTypeReduction.types @@ -25,8 +25,8 @@ var e1: I2 | I3; >I3 : I3 var e2 = i2 || i3; // Type of e2 immediately reduced to I3 ->e2 : I3 ->i2 || i3 : I3 +>e2 : I2 | I3 +>i2 || i3 : I2 | I3 >i2 : I2 >i3 : I3 @@ -38,5 +38,5 @@ var r1 = e1(); // Type of e1 reduced to I3 upon accessing property or signature var r2 = e2(); >r2 : number >e2() : number ->e2 : I3 +>e2 : I2 | I3 diff --git a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types index c6fa610e68a..361a3e90535 100644 --- a/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types +++ b/tests/baselines/reference/unionTypeWithRecursiveSubtypeReduction1.types @@ -39,7 +39,7 @@ var t: Class | Property; >Property : Property t.parent; ->t.parent : Class | Namespace +>t.parent : Module | Class | Namespace >t : Class | Property ->parent : Class | Namespace +>parent : Module | Class | Namespace