-
Notifications
You must be signed in to change notification settings - Fork 0
Filter null in TypeScript #6
Copy link
Copy link
Open
Labels
Description
const removeNull = (element: any): element is Exclude<typeof element, null> => !!element;Usage
[1, true, null, 'lmao'].filter(removeNull) // [1, true, 'lmao'] with narrowed type Credit to @dtinth. From https://twitter.com/dtinth/status/1315714173242728448/photo/1
Reactions are currently unavailable