Skip to content

Instantly share code, notes, and snippets.

@KEIII
Created August 24, 2020 18:08
Show Gist options
  • Save KEIII/d43d6363c4ce813f4a9ae9c0b5714d32 to your computer and use it in GitHub Desktop.
Save KEIII/d43d6363c4ce813f4a9ae9c0b5714d32 to your computer and use it in GitHub Desktop.
TypeScript extra types
export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? RecursivePartial<U>[]
: T[P] extends object
? RecursivePartial<T[P]>
: T[P];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment