-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
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)[].
DmitryScaletta, AlexKMarshall, essential-randomness, ghoullier, alibek-gao and 67 morelf-novelt and oezguerisbertThundercraft5
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript