1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
=== tests/cases/conformance/expressions/typeGuards/typeGuardNesting.ts ===
let strOrBool: string|boolean;
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') {
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let label: string = (typeof strOrBool === 'string') ? strOrBool : "string";
>label : Symbol(label, Decl(typeGuardNesting.ts, 2, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false;
>bool : Symbol(bool, Decl(typeGuardNesting.ts, 3, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string";
>label2 : Symbol(label2, Decl(typeGuardNesting.ts, 4, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false;
>bool2 : Symbol(bool2, Decl(typeGuardNesting.ts, 5, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
}
if ((typeof strOrBool !== 'string' && !strOrBool) || typeof strOrBool !== 'boolean') {
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let label: string = (typeof strOrBool === 'string') ? strOrBool : "string";
>label : Symbol(label, Decl(typeGuardNesting.ts, 9, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let bool: boolean = (typeof strOrBool === 'boolean') ? strOrBool : false;
>bool : Symbol(bool, Decl(typeGuardNesting.ts, 10, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let label2: string = (typeof strOrBool !== 'boolean') ? strOrBool : "string";
>label2 : Symbol(label2, Decl(typeGuardNesting.ts, 11, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
let bool2: boolean = (typeof strOrBool !== 'string') ? strOrBool : false;
>bool2 : Symbol(bool2, Decl(typeGuardNesting.ts, 12, 4))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
>strOrBool : Symbol(strOrBool, Decl(typeGuardNesting.ts, 0, 3))
}
|