Files
tsgo/testdata/baselines/reference/submodule/conformance/controlFlowInstanceOfGuardPrimitives.symbols

53 lines
2.8 KiB
Plaintext

//// [tests/cases/conformance/controlFlow/controlFlowInstanceOfGuardPrimitives.ts] ////
=== controlFlowInstanceOfGuardPrimitives.ts ===
function distinguish(thing: string | number | Date) {
>distinguish : Symbol(distinguish, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 0))
>thing : Symbol(thing, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 21))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
if (thing instanceof Object) {
>thing : Symbol(thing, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 21))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
console.log("Aha!! It's a Date in " + thing.getFullYear());
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>thing.getFullYear : Symbol(Date.getFullYear, Decl(lib.es5.d.ts, --, --))
>thing : Symbol(thing, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 21))
>getFullYear : Symbol(Date.getFullYear, Decl(lib.es5.d.ts, --, --))
} else if (typeof thing === 'string') {
>thing : Symbol(thing, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 21))
console.log("Aha!! It's a string of length " + thing.length);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>thing.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
>thing : Symbol(thing, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 21))
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
} else {
console.log("Aha!! It's the number " + thing.toPrecision(3));
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>thing.toPrecision : Symbol(Number.toPrecision, Decl(lib.es5.d.ts, --, --))
>thing : Symbol(thing, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 21))
>toPrecision : Symbol(Number.toPrecision, Decl(lib.es5.d.ts, --, --))
}
}
distinguish(new Date());
>distinguish : Symbol(distinguish, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 0))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
distinguish("beef");
>distinguish : Symbol(distinguish, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 0))
distinguish(3.14159265);
>distinguish : Symbol(distinguish, Decl(controlFlowInstanceOfGuardPrimitives.ts, 0, 0))