Open
Description
TypeScript Version: 3.3.1 & 3.4.0-dev.20190202
Search Terms:
Code
class Foo {
foo: number = 0;
}
class FooBar extends Foo {
bar: number = 10;
}
async function foo(f: Foo | number) {
if (f instanceof FooBar) {
try {
f = await (async (): Promise<Foo | number> => {
throw new Error();
})();
}
catch (ex) {
console.log(f.bar); // 3.3.1 has an error on this line -- "Property 'bar' does not exist on type 'number | Foo'. Property 'bar' does not exist on type 'number'"
}
}
}
foo(new FooBar());
Expected behavior:
No error as was in TypeScript 3.2.4
Actual behavior:
Error Property 'bar' does not exist on type 'number | Foo'. Property 'bar' does not exist on type 'number'
Related Issues: