Let\'s say I have an interface:
interface IUser {
email: string;
id: number;
phone: string;
};
Then I have a function that expects a
What you want is this
type Subset = U;
this makes sure, that U is a subset of T and returns U as a new type. for example:
interface Foo {
name: string;
age: number;
}
type Bar = Subset;
you can not add new properties to Bar which are not part of Foo - and you can not alter types in a non-compatible way. this also works recursively on nested objects.