TypeScript/tests/cases/conformance/expressions/typeGuards/typeGuardEnums.ts
2015-10-29 17:51:36 -07:00

18 lines
223 B
TypeScript

enum E {}
enum V {}
let x: number|string|E|V;
if (typeof x === "number") {
x; // number|E|V
}
else {
x; // string
}
if (typeof x !== "number") {
x; // string
}
else {
x; // number|E|V
}