35 lines
822 B
Plaintext
35 lines
822 B
Plaintext
=== 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))
|
|
}
|
|
|