Well, using your type Difffrom earlier (which, by the way, is the same as the type Excludethat is now part of the standard library), you can write:
type ObjectDiff<T, U> = Pick<T, Diff<keyof T, keyof U>>;
type AWithoutStuff = ObjectDiff<A, Stuff>; // inferred as { one: string; two: number; }
Crice source
share