Constructs a type by excluding/extracting from T all properties that are assignable to U.
This sounds to me like Exclude and Extract would do this:
interface Person {
id: number;
name: string;
}
type NumbersOnly = Extract<Person, number>; // { id: number }
type NoNumbers = Exclude<Person, number>; // { name: string }
I think "Constructs a type by excluding/extracting from T all types that are assignable to U," more clearly describes removing types from the union, rather than affecting its properties.
The previous description was:
This sounds to me like Exclude and Extract would do this:
I think "Constructs a type by excluding/extracting from
T
all types that are assignable toU
," more clearly describes removing types from the union, rather than affecting its properties.