Created
April 27, 2018 15:43
-
-
Save mkulke/ca6bbb9c038b3c3a2ad360edbb62d049 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | |
function without<T extends object, K extends keyof T>( | |
obj: T, | |
key: K, | |
): Omit<T, K> { | |
const newObj = Object.assign({}, obj); | |
delete newObj[key]; | |
return newObj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment