forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunionRelationshipCheckPasses2(exactoptionalpropertytypes=false).symbols
More file actions
64 lines (49 loc) · 2.67 KB
/
unionRelationshipCheckPasses2(exactoptionalpropertytypes=false).symbols
File metadata and controls
64 lines (49 loc) · 2.67 KB
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
//// [tests/cases/compiler/unionRelationshipCheckPasses2.ts] ////
=== unionRelationshipCheckPasses2.ts ===
// https://github.com/microsoft/TypeScript/issues/61678
export type U = { type: "A"; value: null } | { type: "B"; value: string };
>U : Symbol(U, Decl(unionRelationshipCheckPasses2.ts, 0, 0))
>type : Symbol(type, Decl(unionRelationshipCheckPasses2.ts, 2, 17))
>value : Symbol(value, Decl(unionRelationshipCheckPasses2.ts, 2, 28))
>type : Symbol(type, Decl(unionRelationshipCheckPasses2.ts, 2, 46))
>value : Symbol(value, Decl(unionRelationshipCheckPasses2.ts, 2, 57))
function call<T>(f: () => T): T {
>call : Symbol(call, Decl(unionRelationshipCheckPasses2.ts, 2, 74))
>T : Symbol(T, Decl(unionRelationshipCheckPasses2.ts, 4, 14))
>f : Symbol(f, Decl(unionRelationshipCheckPasses2.ts, 4, 17))
>T : Symbol(T, Decl(unionRelationshipCheckPasses2.ts, 4, 14))
>T : Symbol(T, Decl(unionRelationshipCheckPasses2.ts, 4, 14))
return f();
>f : Symbol(f, Decl(unionRelationshipCheckPasses2.ts, 4, 17))
}
export function functionCall(): U {
>functionCall : Symbol(functionCall, Decl(unionRelationshipCheckPasses2.ts, 6, 1))
>U : Symbol(U, Decl(unionRelationshipCheckPasses2.ts, 0, 0))
return call(() => { // error
>call : Symbol(call, Decl(unionRelationshipCheckPasses2.ts, 2, 74))
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
return { type: "A" };
>type : Symbol(type, Decl(unionRelationshipCheckPasses2.ts, 11, 14))
}
return { type: "B", value: "test" };
>type : Symbol(type, Decl(unionRelationshipCheckPasses2.ts, 14, 12))
>value : Symbol(value, Decl(unionRelationshipCheckPasses2.ts, 14, 23))
});
}
export function directReturn(): U {
>directReturn : Symbol(directReturn, Decl(unionRelationshipCheckPasses2.ts, 16, 1))
>U : Symbol(U, Decl(unionRelationshipCheckPasses2.ts, 0, 0))
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
return { type: "A" }; // error
>type : Symbol(type, Decl(unionRelationshipCheckPasses2.ts, 20, 12))
}
return { type: "B", value: "test" };
>type : Symbol(type, Decl(unionRelationshipCheckPasses2.ts, 23, 10))
>value : Symbol(value, Decl(unionRelationshipCheckPasses2.ts, 23, 21))
}