Subset
TypeSubset
is NOT an official feature of Typescript, but is an encouraged pattern.
type Subset<T extends U, U> = U; interface Foo { name: string; age: number; } type Bar = Subset< Foo, { name: string; } >;
This makes sure that U
is a subset of T
and returns U
as a new type.
Bar
which are not part of Foo