Skip to content

Instantly share code, notes, and snippets.

@FlorianWendelborn
Created April 10, 2022 22:06
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 FlorianWendelborn/460a4cb5d93e4beb5026c54b286ff0d3 to your computer and use it in GitHub Desktop.
Save FlorianWendelborn/460a4cb5d93e4beb5026c54b286ff0d3 to your computer and use it in GitHub Desktop.
null-to-undefined.d.ts
type NullToUndefined<T> = {
[KEY in keyof T]: null extends T[KEY]
? Exclude<T[KEY], null> | undefined
: T[KEY]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment