1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
=== tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference2.ts ===
declare function f1<T>(x: T | string): T;
>f1 : Symbol(f1, Decl(unionAndIntersectionInference2.ts, 0, 0))
>T : Symbol(T, Decl(unionAndIntersectionInference2.ts, 0, 20))
>x : Symbol(x, Decl(unionAndIntersectionInference2.ts, 0, 23))
>T : Symbol(T, Decl(unionAndIntersectionInference2.ts, 0, 20))
>T : Symbol(T, Decl(unionAndIntersectionInference2.ts, 0, 20))
var a1: string;
>a1 : Symbol(a1, Decl(unionAndIntersectionInference2.ts, 2, 3))
var b1: string | string[];
>b1 : Symbol(b1, Decl(unionAndIntersectionInference2.ts, 3, 3))
var c1: string[] | string;
>c1 : Symbol(c1, Decl(unionAndIntersectionInference2.ts, 4, 3))
var d1: string | { name: string };
>d1 : Symbol(d1, Decl(unionAndIntersectionInference2.ts, 5, 3))
>name : Symbol(name, Decl(unionAndIntersectionInference2.ts, 5, 18))
var e1: number | string | boolean;
>e1 : Symbol(e1, Decl(unionAndIntersectionInference2.ts, 6, 3))
f1(a1); // string
>f1 : Symbol(f1, Decl(unionAndIntersectionInference2.ts, 0, 0))
>a1 : Symbol(a1, Decl(unionAndIntersectionInference2.ts, 2, 3))
f1(b1); // string[]
>f1 : Symbol(f1, Decl(unionAndIntersectionInference2.ts, 0, 0))
>b1 : Symbol(b1, Decl(unionAndIntersectionInference2.ts, 3, 3))
f1(c1); // string[]
>f1 : Symbol(f1, Decl(unionAndIntersectionInference2.ts, 0, 0))
>c1 : Symbol(c1, Decl(unionAndIntersectionInference2.ts, 4, 3))
f1(d1); // { name: string }
>f1 : Symbol(f1, Decl(unionAndIntersectionInference2.ts, 0, 0))
>d1 : Symbol(d1, Decl(unionAndIntersectionInference2.ts, 5, 3))
f1(e1); // number | boolean
>f1 : Symbol(f1, Decl(unionAndIntersectionInference2.ts, 0, 0))
>e1 : Symbol(e1, Decl(unionAndIntersectionInference2.ts, 6, 3))
declare function f2<T>(x: T & { name: string }): T;
>f2 : Symbol(f2, Decl(unionAndIntersectionInference2.ts, 11, 7))
>T : Symbol(T, Decl(unionAndIntersectionInference2.ts, 13, 20))
>x : Symbol(x, Decl(unionAndIntersectionInference2.ts, 13, 23))
>T : Symbol(T, Decl(unionAndIntersectionInference2.ts, 13, 20))
>name : Symbol(name, Decl(unionAndIntersectionInference2.ts, 13, 31))
>T : Symbol(T, Decl(unionAndIntersectionInference2.ts, 13, 20))
var a2: string & { name: string };
>a2 : Symbol(a2, Decl(unionAndIntersectionInference2.ts, 15, 3))
>name : Symbol(name, Decl(unionAndIntersectionInference2.ts, 15, 18))
var b2: { name: string } & string[];
>b2 : Symbol(b2, Decl(unionAndIntersectionInference2.ts, 16, 3))
>name : Symbol(name, Decl(unionAndIntersectionInference2.ts, 16, 9))
var c2: string & { name: string } & number;
>c2 : Symbol(c2, Decl(unionAndIntersectionInference2.ts, 17, 3))
>name : Symbol(name, Decl(unionAndIntersectionInference2.ts, 17, 18))
var d2: string & { name: string } & number & { name: string };
>d2 : Symbol(d2, Decl(unionAndIntersectionInference2.ts, 18, 3))
>name : Symbol(name, Decl(unionAndIntersectionInference2.ts, 18, 18))
>name : Symbol(name, Decl(unionAndIntersectionInference2.ts, 18, 46))
f2(a2); // string
>f2 : Symbol(f2, Decl(unionAndIntersectionInference2.ts, 11, 7))
>a2 : Symbol(a2, Decl(unionAndIntersectionInference2.ts, 15, 3))
f2(b2); // string[]
>f2 : Symbol(f2, Decl(unionAndIntersectionInference2.ts, 11, 7))
>b2 : Symbol(b2, Decl(unionAndIntersectionInference2.ts, 16, 3))
f2(c2); // string & number
>f2 : Symbol(f2, Decl(unionAndIntersectionInference2.ts, 11, 7))
>c2 : Symbol(c2, Decl(unionAndIntersectionInference2.ts, 17, 3))
f2(d2); // string & number
>f2 : Symbol(f2, Decl(unionAndIntersectionInference2.ts, 11, 7))
>d2 : Symbol(d2, Decl(unionAndIntersectionInference2.ts, 18, 3))
|