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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
|
=== tests/cases/compiler/contextualTypeShouldBeLiteral.ts ===
interface X {
>X : Symbol(X, Decl(contextualTypeShouldBeLiteral.ts, 0, 0))
type: 'x';
>type : Symbol(X.type, Decl(contextualTypeShouldBeLiteral.ts, 0, 13))
value: string;
>value : Symbol(X.value, Decl(contextualTypeShouldBeLiteral.ts, 1, 14))
method(): void;
>method : Symbol(X.method, Decl(contextualTypeShouldBeLiteral.ts, 2, 18))
}
interface Y {
>Y : Symbol(Y, Decl(contextualTypeShouldBeLiteral.ts, 4, 1))
type: 'y';
>type : Symbol(Y.type, Decl(contextualTypeShouldBeLiteral.ts, 6, 13))
value: 'none' | 'done';
>value : Symbol(Y.value, Decl(contextualTypeShouldBeLiteral.ts, 7, 14))
method(): void;
>method : Symbol(Y.method, Decl(contextualTypeShouldBeLiteral.ts, 8, 27))
}
function foo(bar: X | Y) { }
>foo : Symbol(foo, Decl(contextualTypeShouldBeLiteral.ts, 10, 1))
>bar : Symbol(bar, Decl(contextualTypeShouldBeLiteral.ts, 12, 13))
>X : Symbol(X, Decl(contextualTypeShouldBeLiteral.ts, 0, 0))
>Y : Symbol(Y, Decl(contextualTypeShouldBeLiteral.ts, 4, 1))
foo({
>foo : Symbol(foo, Decl(contextualTypeShouldBeLiteral.ts, 10, 1))
type: 'y',
>type : Symbol(type, Decl(contextualTypeShouldBeLiteral.ts, 14, 5))
value: 'done',
>value : Symbol(value, Decl(contextualTypeShouldBeLiteral.ts, 15, 14))
method() {
>method : Symbol(method, Decl(contextualTypeShouldBeLiteral.ts, 16, 18))
this;
>this : Symbol(Y, Decl(contextualTypeShouldBeLiteral.ts, 4, 1))
this.type;
>this.type : Symbol(Y.type, Decl(contextualTypeShouldBeLiteral.ts, 6, 13))
>this : Symbol(Y, Decl(contextualTypeShouldBeLiteral.ts, 4, 1))
>type : Symbol(Y.type, Decl(contextualTypeShouldBeLiteral.ts, 6, 13))
this.value;
>this.value : Symbol(Y.value, Decl(contextualTypeShouldBeLiteral.ts, 7, 14))
>this : Symbol(Y, Decl(contextualTypeShouldBeLiteral.ts, 4, 1))
>value : Symbol(Y.value, Decl(contextualTypeShouldBeLiteral.ts, 7, 14))
}
});
interface X2 {
>X2 : Symbol(X2, Decl(contextualTypeShouldBeLiteral.ts, 22, 3))
type1: 'x';
>type1 : Symbol(X2.type1, Decl(contextualTypeShouldBeLiteral.ts, 24, 14))
value: string;
>value : Symbol(X2.value, Decl(contextualTypeShouldBeLiteral.ts, 25, 15))
method(): void;
>method : Symbol(X2.method, Decl(contextualTypeShouldBeLiteral.ts, 26, 18))
}
interface Y2 {
>Y2 : Symbol(Y2, Decl(contextualTypeShouldBeLiteral.ts, 28, 1))
type2: 'y';
>type2 : Symbol(Y2.type2, Decl(contextualTypeShouldBeLiteral.ts, 30, 14))
value: 'none' | 'done';
>value : Symbol(Y2.value, Decl(contextualTypeShouldBeLiteral.ts, 31, 15))
method(): void;
>method : Symbol(Y2.method, Decl(contextualTypeShouldBeLiteral.ts, 32, 27))
}
function foo2(bar: X2 | Y2) { }
>foo2 : Symbol(foo2, Decl(contextualTypeShouldBeLiteral.ts, 34, 1))
>bar : Symbol(bar, Decl(contextualTypeShouldBeLiteral.ts, 36, 14))
>X2 : Symbol(X2, Decl(contextualTypeShouldBeLiteral.ts, 22, 3))
>Y2 : Symbol(Y2, Decl(contextualTypeShouldBeLiteral.ts, 28, 1))
foo2({
>foo2 : Symbol(foo2, Decl(contextualTypeShouldBeLiteral.ts, 34, 1))
type2: 'y',
>type2 : Symbol(type2, Decl(contextualTypeShouldBeLiteral.ts, 38, 6))
value: 'done',
>value : Symbol(value, Decl(contextualTypeShouldBeLiteral.ts, 39, 15))
method() {
>method : Symbol(method, Decl(contextualTypeShouldBeLiteral.ts, 40, 18))
this;
this.value;
>this.value : Symbol(value, Decl(contextualTypeShouldBeLiteral.ts, 25, 15), Decl(contextualTypeShouldBeLiteral.ts, 31, 15))
>value : Symbol(value, Decl(contextualTypeShouldBeLiteral.ts, 25, 15), Decl(contextualTypeShouldBeLiteral.ts, 31, 15))
}
});
interface X3 {
>X3 : Symbol(X3, Decl(contextualTypeShouldBeLiteral.ts, 45, 3))
type: 'x';
>type : Symbol(X3.type, Decl(contextualTypeShouldBeLiteral.ts, 47, 14))
value: 1 | 2 | 3;
>value : Symbol(X3.value, Decl(contextualTypeShouldBeLiteral.ts, 48, 14))
xtra: number;
>xtra : Symbol(X3.xtra, Decl(contextualTypeShouldBeLiteral.ts, 49, 21))
}
interface Y3 {
>Y3 : Symbol(Y3, Decl(contextualTypeShouldBeLiteral.ts, 51, 1))
type: 'y';
>type : Symbol(Y3.type, Decl(contextualTypeShouldBeLiteral.ts, 53, 14))
value: 11 | 12 | 13;
>value : Symbol(Y3.value, Decl(contextualTypeShouldBeLiteral.ts, 54, 14))
ytra: number;
>ytra : Symbol(Y3.ytra, Decl(contextualTypeShouldBeLiteral.ts, 55, 24))
}
let xy: X3 | Y3 = {
>xy : Symbol(xy, Decl(contextualTypeShouldBeLiteral.ts, 59, 3))
>X3 : Symbol(X3, Decl(contextualTypeShouldBeLiteral.ts, 45, 3))
>Y3 : Symbol(Y3, Decl(contextualTypeShouldBeLiteral.ts, 51, 1))
type: 'y',
>type : Symbol(type, Decl(contextualTypeShouldBeLiteral.ts, 59, 19))
value: 11,
>value : Symbol(value, Decl(contextualTypeShouldBeLiteral.ts, 60, 14))
ytra: 12
>ytra : Symbol(ytra, Decl(contextualTypeShouldBeLiteral.ts, 61, 14))
};
xy;
>xy : Symbol(xy, Decl(contextualTypeShouldBeLiteral.ts, 59, 3))
interface LikeA {
>LikeA : Symbol(LikeA, Decl(contextualTypeShouldBeLiteral.ts, 65, 3))
x: 'x';
>x : Symbol(LikeA.x, Decl(contextualTypeShouldBeLiteral.ts, 68, 17))
y: 'y';
>y : Symbol(LikeA.y, Decl(contextualTypeShouldBeLiteral.ts, 69, 11))
value: string;
>value : Symbol(LikeA.value, Decl(contextualTypeShouldBeLiteral.ts, 70, 11))
method(): void;
>method : Symbol(LikeA.method, Decl(contextualTypeShouldBeLiteral.ts, 71, 18))
}
interface LikeB {
>LikeB : Symbol(LikeB, Decl(contextualTypeShouldBeLiteral.ts, 73, 1))
x: 'xx';
>x : Symbol(LikeB.x, Decl(contextualTypeShouldBeLiteral.ts, 75, 17))
y: 'yy';
>y : Symbol(LikeB.y, Decl(contextualTypeShouldBeLiteral.ts, 76, 12))
value: number;
>value : Symbol(LikeB.value, Decl(contextualTypeShouldBeLiteral.ts, 77, 12))
method(): void;
>method : Symbol(LikeB.method, Decl(contextualTypeShouldBeLiteral.ts, 78, 18))
}
let xyz: LikeA | LikeB = {
>xyz : Symbol(xyz, Decl(contextualTypeShouldBeLiteral.ts, 82, 3))
>LikeA : Symbol(LikeA, Decl(contextualTypeShouldBeLiteral.ts, 65, 3))
>LikeB : Symbol(LikeB, Decl(contextualTypeShouldBeLiteral.ts, 73, 1))
x: 'x',
>x : Symbol(x, Decl(contextualTypeShouldBeLiteral.ts, 82, 26))
y: 'y',
>y : Symbol(y, Decl(contextualTypeShouldBeLiteral.ts, 83, 11))
value: "foo",
>value : Symbol(value, Decl(contextualTypeShouldBeLiteral.ts, 84, 11))
method() {
>method : Symbol(method, Decl(contextualTypeShouldBeLiteral.ts, 85, 17))
this;
>this : Symbol(LikeA, Decl(contextualTypeShouldBeLiteral.ts, 65, 3))
this.x;
>this.x : Symbol(LikeA.x, Decl(contextualTypeShouldBeLiteral.ts, 68, 17))
>this : Symbol(LikeA, Decl(contextualTypeShouldBeLiteral.ts, 65, 3))
>x : Symbol(LikeA.x, Decl(contextualTypeShouldBeLiteral.ts, 68, 17))
this.y;
>this.y : Symbol(LikeA.y, Decl(contextualTypeShouldBeLiteral.ts, 69, 11))
>this : Symbol(LikeA, Decl(contextualTypeShouldBeLiteral.ts, 65, 3))
>y : Symbol(LikeA.y, Decl(contextualTypeShouldBeLiteral.ts, 69, 11))
this.value;
>this.value : Symbol(LikeA.value, Decl(contextualTypeShouldBeLiteral.ts, 70, 11))
>this : Symbol(LikeA, Decl(contextualTypeShouldBeLiteral.ts, 65, 3))
>value : Symbol(LikeA.value, Decl(contextualTypeShouldBeLiteral.ts, 70, 11))
}
};
xyz;
>xyz : Symbol(xyz, Decl(contextualTypeShouldBeLiteral.ts, 82, 3))
|