mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Accept new baselines
This commit is contained in:
@@ -20,7 +20,7 @@ var e1: number | string | boolean;
|
||||
>e1 : string | number | boolean
|
||||
|
||||
f1(a1); // string
|
||||
>f1(a1) : string
|
||||
>f1(a1) : never
|
||||
>f1 : <T>(x: string | T) => T
|
||||
>a1 : string
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -16,7 +16,7 @@ var a1: number;
|
||||
|
||||
var a1 = f(1, 2);
|
||||
>a1 : number
|
||||
>f(1, 2) : any
|
||||
>f(1, 2) : 1 | 2
|
||||
>f : <T>(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 : <T>(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 : <T>(x: string | boolean | T) => T
|
||||
>"abc" : "abc"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user