TypeScript Version: 2.6.1, 2.7.0-dev.20171110
functiontest(a: boolean): false|Date{if(a){returnnewDate();}returnfalse;}asyncfunctiontest2(){letb=test(true);if(!b){b=newDate();}awaitPromise.all([]).then(()=>{b.getDate();//Should compile.})}Expected behavior:
Should compile
Actual behavior:
Throws with Property 'getDate' does not exist on type 'true'.
This can be reproduced with any return type and even when type inference is used.
TypeScript Version: 2.6.1, 2.7.0-dev.20171110
Expected behavior:
Should compile
Actual behavior:
Throws with
Property 'getDate' does not exist on type 'true'.This can be reproduced with any return type and even when type inference is used.