TypeScript Version: 2.6.1
Code
functiontest<T>(x: T,f: (y: T)=>void){returnx;}letz: false=false;test(z,x=>{z=x;});// ------------^// [ts]// Type 'boolean | undefined' is not assignable to type 'false | undefined'.// Type 'true' is not assignable to type 'false | undefined'.Expected behavior:
z and x should be of the same type
Actual behavior:
x is being inferred as boolean instead of false
TypeScript Version: 2.6.1
Code
Expected behavior:
zandxshould be of the same typeActual behavior:
xis being inferred asbooleaninstead offalse