A type modifier that allows to construct a generic type that requires only one property of a given type.
The base type.
the name of the property to require in the new type.
Conider that we have a type
type User = { id: string name?: string email?: string} Copy
type User = { id: string name?: string email?: string}
Then we can create a type like so:
type UserWithName = WithRequired<User, 'name'> Copy
type UserWithName = WithRequired<User, 'name'>
A type modifier that allows to construct a generic type that requires only one property of a given type.