Skip to content

Instantly share code, notes, and snippets.

@charlee
Created January 13, 2022 15:27
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 charlee/200b4da6542866011ac2664f8191cd9b to your computer and use it in GitHub Desktop.
Save charlee/200b4da6542866011ac2664f8191cd9b to your computer and use it in GitHub Desktop.
TypeScript Utility types
// Remove null or undefine from array items
type NonNullableArray<T> = T extends Array<infer Item> ? Array<NonNullable<Item>> : never;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment