forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbooleanLiteralsContextuallyTypedFromUnion.symbols
More file actions
100 lines (82 loc) · 5.88 KB
/
booleanLiteralsContextuallyTypedFromUnion.symbols
File metadata and controls
100 lines (82 loc) · 5.88 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//// [tests/cases/compiler/booleanLiteralsContextuallyTypedFromUnion.tsx] ////
=== booleanLiteralsContextuallyTypedFromUnion.tsx ===
/// <reference path="react.d.ts" />
interface A { isIt: true; text: string; }
>A : Symbol(A, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 0))
>isIt : Symbol(A.isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 13))
>text : Symbol(A.text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 25))
interface B { isIt: false; value: number; }
>B : Symbol(B, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 41))
>isIt : Symbol(B.isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 13))
>value : Symbol(B.value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 26))
type C = A | B;
>C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 43))
>A : Symbol(A, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 0))
>B : Symbol(B, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 41))
const isIt = Math.random() > 0.5;
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5))
>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, --, --))
const c: C = isIt ? { isIt, text: 'hey' } : { isIt, value: 123 };
>c : Symbol(c, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 5))
>C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 43))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 21))
>text : Symbol(text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 27))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 45))
>value : Symbol(value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 51))
const cc: C = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 };
>cc : Symbol(cc, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 5))
>C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 43))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 22))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5))
>text : Symbol(text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 34))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 52))
>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5))
>value : Symbol(value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 64))
type ComponentProps =
>ComponentProps : Symbol(ComponentProps, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 78))
| {
optionalBool: true;
>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 9, 7))
mandatoryFn: () => void;
>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 10, 27))
}
| {
optionalBool: false;
>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 13, 7))
};
let Funk = (_props: ComponentProps) => <div>Hello</div>;
>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3))
>_props : Symbol(_props, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 12))
>ComponentProps : Symbol(ComponentProps, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 78))
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2402, 45))
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2402, 45))
let Fail1 = () => <Funk mandatoryFn={() => { }} optionalBool={true} />
>Fail1 : Symbol(Fail1, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 19, 3))
>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3))
>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 19, 23))
>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 19, 47))
let Fail2 = () => <Funk mandatoryFn={() => { }} optionalBool={true as true} />
>Fail2 : Symbol(Fail2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 3))
>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3))
>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 23))
>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 47))
let True = true as true;
>True : Symbol(True, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 21, 3))
let Fail3 = () => <Funk mandatoryFn={() => { }} optionalBool={True} />
>Fail3 : Symbol(Fail3, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 3))
>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3))
>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 23))
>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 47))
>True : Symbol(True, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 21, 3))
let attrs2 = { optionalBool: true as true, mandatoryFn: () => { } }
>attrs2 : Symbol(attrs2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 3))
>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 14))
>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 42))
let Success = () => <Funk {...attrs2} />
>Success : Symbol(Success, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 24, 3))
>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3))
>attrs2 : Symbol(attrs2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 3))