Skip to content

Instantly share code, notes, and snippets.

@satansdeer
Created December 28, 2018 08:57
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 satansdeer/2fef894ecf5d8114f3a2816c464c0ca6 to your computer and use it in GitHub Desktop.
Save satansdeer/2fef894ecf5d8114f3a2816c464c0ca6 to your computer and use it in GitHub Desktop.
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