diff --git a/tests/baselines/reference/unionAndIntersectionInference2.types b/tests/baselines/reference/unionAndIntersectionInference2.types index a163b25ce28..031354506b7 100644 --- a/tests/baselines/reference/unionAndIntersectionInference2.types +++ b/tests/baselines/reference/unionAndIntersectionInference2.types @@ -20,7 +20,7 @@ var e1: number | string | boolean; >e1 : string | number | boolean f1(a1); // string ->f1(a1) : string +>f1(a1) : never >f1 : (x: string | T) => T >a1 : string diff --git a/tests/baselines/reference/unionTypeInference.errors.txt b/tests/baselines/reference/unionTypeInference.errors.txt index dfda0d57c2b..ec5c0e11f8d 100644 --- a/tests/baselines/reference/unionTypeInference.errors.txt +++ b/tests/baselines/reference/unionTypeInference.errors.txt @@ -1,7 +1,8 @@ -tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(9,15): error TS2345: Argument of type '2' is not assignable to parameter of type 'string | 1'. +tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a3' must be of type 'number', but here has type 'string | number'. +tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts(31,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'c2' must be of type 'string', but here has type 'never'. -==== tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts (1 errors) ==== +==== tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts (2 errors) ==== // Verify that inferences made *to* a type parameter in a union type are secondary // to inferences made directly to that type parameter @@ -11,12 +12,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference var a1: number; var a1 = f(1, 2); - ~ -!!! error TS2345: Argument of type '2' is not assignable to parameter of type 'string | 1'. var a2: number; var a2 = f(1, "hello"); var a3: number; var a3 = f(1, a1 || "hello"); + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a3' must be of type 'number', but here has type 'string | number'. +!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts:12:5: 'a3' was also declared here. var a4: any; var a4 = f(undefined, "abc"); @@ -35,4 +37,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference var c1 = h(5); var c2: string; var c2 = h("abc"); + ~~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c2' must be of type 'string', but here has type 'never'. +!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts:30:5: 'c2' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeInference.types b/tests/baselines/reference/unionTypeInference.types index e712916c2ff..fc5b777ff5a 100644 --- a/tests/baselines/reference/unionTypeInference.types +++ b/tests/baselines/reference/unionTypeInference.types @@ -16,7 +16,7 @@ var a1: number; var a1 = f(1, 2); >a1 : number ->f(1, 2) : any +>f(1, 2) : 1 | 2 >f : (x: T, y: string | T) => T >1 : 1 >2 : 2 @@ -36,7 +36,7 @@ var a3: number; var a3 = f(1, a1 || "hello"); >a3 : number ->f(1, a1 || "hello") : number +>f(1, a1 || "hello") : number | "hello" >f : (x: T, y: string | T) => T >1 : 1 >a1 || "hello" : number | "hello" @@ -107,7 +107,7 @@ var c2: string; var c2 = h("abc"); >c2 : string ->h("abc") : "abc" +>h("abc") : never >h : (x: string | boolean | T) => T >"abc" : "abc"