Closed
Description
I have come across issues such as #7657, #20812 and #20218 as well as SO questions such as this one, but they all deal with type guards.
Could it be made so that the following code:
const items: (number | null)[] = [1,2,3,null];
const numbers = items.filter(i => i !== null);
…just works - infers that numbers
is number[]
with --strictNullChecks
on? I think this should be out of the box behavior with TypeScript and lib.d.ts
typings. Is this possible?