Test that `typeof x === 'random' as string`: 1. Does not issue an error. 2. Does not narrow.
26 lines
446 B
Plaintext
26 lines
446 B
Plaintext
=== tests/cases/conformance/es6/Symbols/symbolType17.ts ===
|
|
interface Foo { prop }
|
|
>Foo : Foo
|
|
>prop : any
|
|
|
|
var x: symbol | Foo;
|
|
>x : symbol | Foo
|
|
>Foo : Foo
|
|
|
|
x;
|
|
>x : symbol | Foo
|
|
|
|
if (typeof x === "symbol") {
|
|
>typeof x === "symbol" : boolean
|
|
>typeof x : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
|
>x : symbol | Foo
|
|
>"symbol" : "symbol"
|
|
|
|
x;
|
|
>x : symbol
|
|
}
|
|
else {
|
|
x;
|
|
>x : Foo
|
|
}
|