Closed
Description
[0, 1, 2, null, undefined].filter(x => x)
unintendedly (for me) evaluates to [1, 2]
.
What do you think about changing declaration of Array.prototype.filter
(or any higher-order function which takes predicate) to
filter(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
from
filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
I manually changing lib-es5 from better-typescript-lib and that works good for my project.