TypeScript Version: 2.3
Code
constevenSquares: number[]=[1,2,3,4].map(x=>x%2===0 ? x*x : null).filter(x=>!!x);
with strictNullChecks enabled.
Expected behavior:
This should type check. The type of evenSquares should be number[].
Actual behavior:
The type of evenSquares is deduced as (number|null)[], despite the null values being removed via the call to .filter.
TypeScript Version: 2.3
Code
with
strictNullChecksenabled.Expected behavior:
This should type check. The type of
evenSquaresshould benumber[].Actual behavior:
The type of
evenSquaresis deduced as(number|null)[], despite the null values being removed via the call to.filter.