Created
July 25, 2023 16:29
-
-
Save wmakeev/2f6dca8d397d4e09c12ac47981bb5c57 to your computer and use it in GitHub Desktop.
[JS typeguards] #typescript #typeguard #js #jsdoc
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
/** | |
* Checks if the value is neither `null` or `undefined`. | |
* @template T | |
* @param {T} value The value to check. | |
* @returns { value is NonNullable<T> } Returns `true` if `value` is non-nullable, else `false`. | |
*/ | |
export default function isNonNullable(value) { | |
return value != null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment