TypeScript/tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts
2015-10-28 13:48:32 -07:00

9 lines
No EOL
359 B
TypeScript

var x: string|number;
var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed;
var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr;
var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed;
var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr;