TypeScript/tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts
Anders Hejlsberg 7c45c7ba9f Fixing tests
2016-03-22 10:50:06 -07:00

21 lines
No EOL
311 B
TypeScript

// @declaration: true
type T = number | "foo" | "bar";
var x: "foo" | "bar" | number;
var y: T = undefined;
if (x === "foo") {
let a = x;
}
else if (x !== "bar") {
let b = x || y;
}
else {
let c = x;
let d = y;
let e: (typeof x) | (typeof y) = c || d;
}
x = y;
y = x;