Created
April 10, 2022 22:06
-
-
Save FlorianWendelborn/460a4cb5d93e4beb5026c54b286ff0d3 to your computer and use it in GitHub Desktop.
null-to-undefined.d.ts
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
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