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
|
=== tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts ===
enum E {}
>E : Symbol(E, Decl(typeGuardEnums.ts, 0, 0))
enum V {}
>V : Symbol(V, Decl(typeGuardEnums.ts, 0, 9))
let x: number|string|E|V;
>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3))
>E : Symbol(E, Decl(typeGuardEnums.ts, 0, 0))
>V : Symbol(V, Decl(typeGuardEnums.ts, 0, 9))
if (typeof x === "number") {
>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3))
x; // number|E|V
>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3))
}
else {
x; // string
>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3))
}
if (typeof x !== "number") {
>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3))
x; // string
>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3))
}
else {
x; // number|E|V
>x : Symbol(x, Decl(typeGuardEnums.ts, 3, 3))
}
|