This could be a dup of #14748; they seem related
TypeScript Version: 2.7.0-dev.20171102
Code
See in playground
classA{name: string;}classB{age: number;}letx: A|B;if(xinstanceofA){console.log(x.name);// ok: x has type AsetTimeout(()=>{console.log(x.name);// ** COMPILE ERROR: x has type A | B here});}else{console.log(x.age);// ok: x has type B heresetTimeout(()=>{console.log(x.age);// ** COMPILE ERROR: x has type A | B here});}Expected behavior:
This should compile.
Actual behavior:
It does not compile
This could be a dup of #14748; they seem related
TypeScript Version: 2.7.0-dev.20171102
Code
See in playground
Expected behavior:
This should compile.
Actual behavior:
It does not compile