Skip to content

Instantly share code, notes, and snippets.

@TylorS
Created January 1, 2018 17:15
Show Gist options
  • Save TylorS/182bb6d11f1e2819f83aa5207e2a6332 to your computer and use it in GitHub Desktop.
Save TylorS/182bb6d11f1e2819f83aa5207e2a6332 to your computer and use it in GitHub Desktop.
Dissoc Type For Typescript
type Subtract<A extends string, B extends string> = {
readonly [Key in A]: (Record<B, never> & Record<string, Key>)[Key]
}[A]
type Dissoc<A, B extends string> = Readonly<Pick<A, Subtract<keyof A, B>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment