Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save austonpramodh/9003224e8fba70d0a614260dda3188a8 to your computer and use it in GitHub Desktop.

Select an option

Save austonpramodh/9003224e8fba70d0a614260dda3188a8 to your computer and use it in GitHub Desktop.
Useful Typescript Generics
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