Skip to content

Instantly share code, notes, and snippets.

@artakvg
Created March 14, 2019 18:40
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 artakvg/923dab213123f38d323a7f5aa6558b94 to your computer and use it in GitHub Desktop.
Save artakvg/923dab213123f38d323a7f5aa6558b94 to your computer and use it in GitHub Desktop.
some of parameters from original type - Typescript
type Diff<T, U> = T extends U ? never : T;
type OptionalExceptFor<T, TRequired extends keyof T> = Partial<T> & Pick<T, TRequired>;
type RequiredExceptFor<T, TOptional extends keyof T> = Pick<T, Diff<keyof T, TOptional>> & Partial<T>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment