Created
July 6, 2023 13:26
-
-
Save atomicmattie/df8a03670360721754eab5bcc5f43fcf to your computer and use it in GitHub Desktop.
type guard for undefined values
This file contains 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 a value is undefined, serving as a type guard for narrowing. | |
* | |
* @param value value to check | |
* @returns true if value is `undefined` | |
*/ | |
export const isUndefined = (value: any): value is undefined => typeof value === 'undefined'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment