Skip to content

Instantly share code, notes, and snippets.

@atomicmattie
Created July 6, 2023 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomicmattie/df8a03670360721754eab5bcc5f43fcf to your computer and use it in GitHub Desktop.
Save atomicmattie/df8a03670360721754eab5bcc5f43fcf to your computer and use it in GitHub Desktop.
type guard for undefined values
/**
* 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