Created
December 28, 2018 08:57
-
-
Save satansdeer/2fef894ecf5d8114f3a2816c464c0ca6 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 testGenerics< | |
P extends { stays: string; getsRemoved: string }, | |
R = Omit<P, "getsRemoved">, | |
>(argumentP: P, argumentR: R) { | |
return null; | |
} | |
testGenerics({ stays: "foo", getsRemoved: "bar", test: 1 }, {}); // Why doesn't it complain about missign "stays" attribute? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment