Creates a type with all properties of T except for those in union K. This is a stricter version that requires K to extend keyof T.
T
K
keyof T
The object type to omit from.
The union of keys to omit, must extend keyof T.
An object type without the specified properties.
type Person = { name: string; age: number; email: string };type PublicInfo = StrictOmit<Person, 'email'>; // { name: string; age: number }// type Invalid = StrictOmit<Person, 'email' | 'invalid'>; // Error: 'invalid' is not a key of Person Copy
type Person = { name: string; age: number; email: string };type PublicInfo = StrictOmit<Person, 'email'>; // { name: string; age: number }// type Invalid = StrictOmit<Person, 'email' | 'invalid'>; // Error: 'invalid' is not a key of Person
Creates a type with all properties of
Texcept for those in unionK. This is a stricter version that requiresKto extendkeyof T.