Skip to content

Instantly share code, notes, and snippets.

@alienzhou
Created October 11, 2021 13:57
Show Gist options
  • Select an option

  • Save alienzhou/42d3a2237ba2ff6d7db55c1d7113e14e to your computer and use it in GitHub Desktop.

Select an option

Save alienzhou/42d3a2237ba2ff6d7db55c1d7113e14e to your computer and use it in GitHub Desktop.
Utils in Typescript
// from https://gist.github.com/navix/6c25c15e0a2d3cd0e5bce999e0086fc9
export type DeepPartial<T> = T extends Function ? T : (T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T);
export type DeepRequired<T> = T extends Function ? T : (T extends object ? { [P in keyof T]-?: DeepRequired<T[P]>; } : T);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment