|
1 | 1 | //// [tests/cases/compiler/booleanLiteralsContextuallyTypedFromUnion.tsx] //// |
2 | 2 |
|
3 | 3 | === booleanLiteralsContextuallyTypedFromUnion.tsx === |
| 4 | +/// <reference path="react.d.ts" /> |
4 | 5 | interface A { isIt: true; text: string; } |
5 | 6 | >A : Symbol(A, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 0)) |
6 | | ->isIt : Symbol(A.isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 13)) |
7 | | ->text : Symbol(A.text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 25)) |
| 7 | +>isIt : Symbol(A.isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 13)) |
| 8 | +>text : Symbol(A.text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 25)) |
8 | 9 |
|
9 | 10 | interface B { isIt: false; value: number; } |
10 | | ->B : Symbol(B, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 41)) |
11 | | ->isIt : Symbol(B.isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 13)) |
12 | | ->value : Symbol(B.value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 26)) |
| 11 | +>B : Symbol(B, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 41)) |
| 12 | +>isIt : Symbol(B.isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 13)) |
| 13 | +>value : Symbol(B.value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 26)) |
13 | 14 |
|
14 | 15 | type C = A | B; |
15 | | ->C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 43)) |
| 16 | +>C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 43)) |
16 | 17 | >A : Symbol(A, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 0)) |
17 | | ->B : Symbol(B, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 0, 41)) |
| 18 | +>B : Symbol(B, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 41)) |
18 | 19 |
|
19 | 20 | const isIt = Math.random() > 0.5; |
20 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 3, 5)) |
| 21 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5)) |
21 | 22 | >Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) |
22 | 23 | >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, --, --)) |
23 | 24 | >random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) |
24 | 25 |
|
25 | 26 | const c: C = isIt ? { isIt, text: 'hey' } : { isIt, value: 123 }; |
26 | | ->c : Symbol(c, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5)) |
27 | | ->C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 43)) |
28 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 3, 5)) |
29 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 21)) |
30 | | ->text : Symbol(text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 27)) |
31 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 45)) |
32 | | ->value : Symbol(value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 51)) |
| 27 | +>c : Symbol(c, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 5)) |
| 28 | +>C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 43)) |
| 29 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5)) |
| 30 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 21)) |
| 31 | +>text : Symbol(text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 27)) |
| 32 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 45)) |
| 33 | +>value : Symbol(value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 51)) |
33 | 34 |
|
34 | 35 | const cc: C = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; |
35 | | ->cc : Symbol(cc, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 5)) |
36 | | ->C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 1, 43)) |
37 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 3, 5)) |
38 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 22)) |
39 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 3, 5)) |
40 | | ->text : Symbol(text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 34)) |
41 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 52)) |
42 | | ->isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 3, 5)) |
43 | | ->value : Symbol(value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 64)) |
| 36 | +>cc : Symbol(cc, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 5)) |
| 37 | +>C : Symbol(C, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 2, 43)) |
| 38 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5)) |
| 39 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 22)) |
| 40 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5)) |
| 41 | +>text : Symbol(text, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 34)) |
| 42 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 52)) |
| 43 | +>isIt : Symbol(isIt, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 4, 5)) |
| 44 | +>value : Symbol(value, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 64)) |
44 | 45 |
|
45 | 46 | type ComponentProps = |
46 | | ->ComponentProps : Symbol(ComponentProps, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 78)) |
| 47 | +>ComponentProps : Symbol(ComponentProps, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 78)) |
47 | 48 |
|
48 | 49 | | { |
49 | 50 | optionalBool: true; |
50 | | ->optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 8, 7)) |
| 51 | +>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 9, 7)) |
51 | 52 |
|
52 | 53 | mandatoryFn: () => void; |
53 | | ->mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 9, 27)) |
| 54 | +>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 10, 27)) |
54 | 55 | } |
55 | 56 | | { |
56 | 57 | optionalBool: false; |
57 | | ->optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 12, 7)) |
| 58 | +>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 13, 7)) |
58 | 59 |
|
59 | 60 | }; |
60 | 61 |
|
61 | 62 | let Funk = (_props: ComponentProps) => <div>Hello</div>; |
62 | | ->Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 16, 3)) |
63 | | ->_props : Symbol(_props, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 16, 12)) |
64 | | ->ComponentProps : Symbol(ComponentProps, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 5, 78)) |
| 63 | +>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3)) |
| 64 | +>_props : Symbol(_props, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 12)) |
| 65 | +>ComponentProps : Symbol(ComponentProps, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 6, 78)) |
65 | 66 | >div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45)) |
66 | 67 | >div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45)) |
67 | 68 |
|
68 | 69 | let Fail1 = () => <Funk mandatoryFn={() => { }} optionalBool={true} /> |
69 | | ->Fail1 : Symbol(Fail1, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 18, 3)) |
70 | | ->Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 16, 3)) |
71 | | ->mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 18, 23)) |
72 | | ->optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 18, 47)) |
73 | | - |
74 | | -let Fail2 = () => <Funk mandatoryFn={() => { }} optionalBool={true as true} /> |
75 | | ->Fail2 : Symbol(Fail2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 19, 3)) |
76 | | ->Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 16, 3)) |
| 70 | +>Fail1 : Symbol(Fail1, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 19, 3)) |
| 71 | +>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3)) |
77 | 72 | >mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 19, 23)) |
78 | 73 | >optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 19, 47)) |
79 | 74 |
|
| 75 | +let Fail2 = () => <Funk mandatoryFn={() => { }} optionalBool={true as true} /> |
| 76 | +>Fail2 : Symbol(Fail2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 3)) |
| 77 | +>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3)) |
| 78 | +>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 23)) |
| 79 | +>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 47)) |
| 80 | + |
80 | 81 | let True = true as true; |
81 | | ->True : Symbol(True, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 3)) |
| 82 | +>True : Symbol(True, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 21, 3)) |
82 | 83 |
|
83 | 84 | let Fail3 = () => <Funk mandatoryFn={() => { }} optionalBool={True} /> |
84 | | ->Fail3 : Symbol(Fail3, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 21, 3)) |
85 | | ->Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 16, 3)) |
86 | | ->mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 21, 23)) |
87 | | ->optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 21, 47)) |
88 | | ->True : Symbol(True, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 20, 3)) |
| 85 | +>Fail3 : Symbol(Fail3, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 3)) |
| 86 | +>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3)) |
| 87 | +>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 23)) |
| 88 | +>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 47)) |
| 89 | +>True : Symbol(True, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 21, 3)) |
89 | 90 |
|
90 | 91 | let attrs2 = { optionalBool: true as true, mandatoryFn: () => { } } |
91 | | ->attrs2 : Symbol(attrs2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 3)) |
92 | | ->optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 14)) |
93 | | ->mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 42)) |
| 92 | +>attrs2 : Symbol(attrs2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 3)) |
| 93 | +>optionalBool : Symbol(optionalBool, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 14)) |
| 94 | +>mandatoryFn : Symbol(mandatoryFn, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 42)) |
94 | 95 |
|
95 | 96 | let Success = () => <Funk {...attrs2} /> |
96 | | ->Success : Symbol(Success, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 3)) |
97 | | ->Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 16, 3)) |
98 | | ->attrs2 : Symbol(attrs2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 22, 3)) |
| 97 | +>Success : Symbol(Success, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 24, 3)) |
| 98 | +>Funk : Symbol(Funk, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 17, 3)) |
| 99 | +>attrs2 : Symbol(attrs2, Decl(booleanLiteralsContextuallyTypedFromUnion.tsx, 23, 3)) |
99 | 100 |
|
0 commit comments