TypeScript/tests/baselines/reference/typeGuardRedundancy.types
2016-07-18 17:18:35 -07:00

85 lines
3.2 KiB
Plaintext

=== tests/cases/conformance/expressions/typeGuards/typeGuardRedundancy.ts ===
var x: string|number;
>x : string | number
var r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed;
>r1 : (from: number, length?: number) => string
>typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed : (from: number, length?: number) => string
>typeof x === "string" && typeof x === "string" : boolean
>typeof x === "string" : boolean
>typeof x : string
>x : string | number
>"string" : "string"
>typeof x === "string" : boolean
>typeof x : string
>x : string
>"string" : "string"
>x.substr : (from: number, length?: number) => string
>x : string
>substr : (from: number, length?: number) => string
>x.toFixed : (fractionDigits?: number) => string
>x : number
>toFixed : (fractionDigits?: number) => string
var r2 = !(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr;
>r2 : (from: number, length?: number) => string
>!(typeof x === "string" && typeof x === "string") ? x.toFixed : x.substr : (from: number, length?: number) => string
>!(typeof x === "string" && typeof x === "string") : boolean
>(typeof x === "string" && typeof x === "string") : boolean
>typeof x === "string" && typeof x === "string" : boolean
>typeof x === "string" : boolean
>typeof x : string
>x : string | number
>"string" : "string"
>typeof x === "string" : boolean
>typeof x : string
>x : string
>"string" : "string"
>x.toFixed : (fractionDigits?: number) => string
>x : number
>toFixed : (fractionDigits?: number) => string
>x.substr : (from: number, length?: number) => string
>x : string
>substr : (from: number, length?: number) => string
var r3 = typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed;
>r3 : (from: number, length?: number) => string
>typeof x === "string" || typeof x === "string" ? x.substr : x.toFixed : (from: number, length?: number) => string
>typeof x === "string" || typeof x === "string" : boolean
>typeof x === "string" : boolean
>typeof x : string
>x : string | number
>"string" : "string"
>typeof x === "string" : boolean
>typeof x : string
>x : number
>"string" : "string"
>x.substr : (from: number, length?: number) => string
>x : string
>substr : (from: number, length?: number) => string
>x.toFixed : (fractionDigits?: number) => string
>x : number
>toFixed : (fractionDigits?: number) => string
var r4 = !(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr;
>r4 : (from: number, length?: number) => string
>!(typeof x === "string" || typeof x === "string") ? x.toFixed : x.substr : (from: number, length?: number) => string
>!(typeof x === "string" || typeof x === "string") : boolean
>(typeof x === "string" || typeof x === "string") : boolean
>typeof x === "string" || typeof x === "string" : boolean
>typeof x === "string" : boolean
>typeof x : string
>x : string | number
>"string" : "string"
>typeof x === "string" : boolean
>typeof x : string
>x : number
>"string" : "string"
>x.toFixed : (fractionDigits?: number) => string
>x : number
>toFixed : (fractionDigits?: number) => string
>x.substr : (from: number, length?: number) => string
>x : string
>substr : (from: number, length?: number) => string