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
|
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts ===
type T = number | "foo" | "bar";
>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes03.ts, 0, 0))
var x: "foo" | "bar" | number;
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
var y: T = undefined;
>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3))
>T : Symbol(T, Decl(stringLiteralTypesInUnionTypes03.ts, 0, 0))
>undefined : Symbol(undefined)
if (x === "foo") {
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
let a = x;
>a : Symbol(a, Decl(stringLiteralTypesInUnionTypes03.ts, 7, 7))
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
}
else if (x !== "bar") {
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
let b = x || y;
>b : Symbol(b, Decl(stringLiteralTypesInUnionTypes03.ts, 10, 7))
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3))
}
else {
let c = x;
>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes03.ts, 13, 7))
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
let d = y;
>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes03.ts, 14, 7))
>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3))
let e: (typeof x) | (typeof y) = c || d;
>e : Symbol(e, Decl(stringLiteralTypesInUnionTypes03.ts, 15, 7))
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3))
>c : Symbol(c, Decl(stringLiteralTypesInUnionTypes03.ts, 13, 7))
>d : Symbol(d, Decl(stringLiteralTypesInUnionTypes03.ts, 14, 7))
}
x = y;
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3))
y = x;
>y : Symbol(y, Decl(stringLiteralTypesInUnionTypes03.ts, 4, 3))
>x : Symbol(x, Decl(stringLiteralTypesInUnionTypes03.ts, 3, 3))
|