Open
Description
lib Update Request
Configuration Check
My compilation target is ES2015
and my lib is the default
.
Missing / Incorrect Definition
I would love to add an overload to Array.filter which takes in a common use case of passing a Boolean
directly to .filter
. This would offer a simple, intuitive workaround for a common pain point with .filter
.
This could be achieved via an overload adding BooleanConstructor
, and a type predicate.
Sample Code
const arr = ['1', undefined];
const filteredArr = arr.filter(Boolean);
filteredArr
should be string[]
, not (string | undefined)[]
.