Created
October 31, 2019 13:02
-
-
Save js2me/8360d9a6b4e6c61579a4832544f00d58 to your computer and use it in GitHub Desktop.
Sexy common TypeScript types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Mutate<T, PropertyName extends keyof T, NewValue> = Omit<T, PropertyName> & { | |
[K in keyof T]: K extends PropertyName ? NewValue : T[K]; | |
} | |
type PickAndOmit<TPick, TOmit, PropertyName extends (keyof TPick & keyof TOmit)> = Pick<TPick, PropertyName> & Omit<TOmit, PropertyName> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment