Created
May 8, 2021 06:01
-
-
Save austonpramodh/9003224e8fba70d0a614260dda3188a8 to your computer and use it in GitHub Desktop.
Useful Typescript Generics
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
| type ConvertNullableToUndefined<T extends Record<never, never>> = { | |
| [K in keyof T]: T[K] extends NonNullable<T[K]> ? T[K]: (NonNullable<T[K]> | undefined) | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment