|
| 1 | +=== tests/cases/compiler/narrowingTypeofObject.ts === |
| 2 | +interface F { (): string } |
| 3 | +>F : Symbol(F, Decl(narrowingTypeofObject.ts, 0, 0)) |
| 4 | + |
| 5 | +function test(x: number & { _foo: string }) { |
| 6 | +>test : Symbol(test, Decl(narrowingTypeofObject.ts, 0, 26)) |
| 7 | +>x : Symbol(x, Decl(narrowingTypeofObject.ts, 2, 14)) |
| 8 | +>_foo : Symbol(_foo, Decl(narrowingTypeofObject.ts, 2, 27)) |
| 9 | + |
| 10 | + if (typeof x === 'object') { |
| 11 | +>x : Symbol(x, Decl(narrowingTypeofObject.ts, 2, 14)) |
| 12 | + |
| 13 | + x; |
| 14 | +>x : Symbol(x, Decl(narrowingTypeofObject.ts, 2, 14)) |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +function f1(x: F & { foo: number }) { |
| 19 | +>f1 : Symbol(f1, Decl(narrowingTypeofObject.ts, 6, 1)) |
| 20 | +>x : Symbol(x, Decl(narrowingTypeofObject.ts, 8, 12)) |
| 21 | +>F : Symbol(F, Decl(narrowingTypeofObject.ts, 0, 0)) |
| 22 | +>foo : Symbol(foo, Decl(narrowingTypeofObject.ts, 8, 20)) |
| 23 | + |
| 24 | + if (typeof x !== "object") { |
| 25 | +>x : Symbol(x, Decl(narrowingTypeofObject.ts, 8, 12)) |
| 26 | + |
| 27 | + x; |
| 28 | +>x : Symbol(x, Decl(narrowingTypeofObject.ts, 8, 12)) |
| 29 | + } |
| 30 | +} |
0 commit comments