Created
January 25, 2023 12:32
-
-
Save KubaJastrz/a7265c83b957558a16884120c53f11e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = ["foo", "bar", null, "zoo", null, undefined]; | |
const filterdArray = array.filter(notEmpty); | |
function notEmpty<T>(value: T): value is Exclude<typeof value, null | undefined> { | |
return value !== null && value !== undefined; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment