Creates a type by picking a set of properties from T whose keys are in union K. This is a stricter version that requires K to extend keyof T.
T
K
keyof T
The object type to pick from.
The union of keys to pick, must extend keyof T.
An object type with only the specified properties.
type Person = { name: string; age: number; email: string };type BasicInfo = StrictPick<Person, 'name' | 'age'>; // { name: string; age: number }// type Invalid = StrictPick<Person, 'name' | 'invalid'>; // Error: 'invalid' is not a key of Person Copy
type Person = { name: string; age: number; email: string };type BasicInfo = StrictPick<Person, 'name' | 'age'>; // { name: string; age: number }// type Invalid = StrictPick<Person, 'name' | 'invalid'>; // Error: 'invalid' is not a key of Person
Creates a type by picking a set of properties from
Twhose keys are in unionK. This is a stricter version that requiresKto extendkeyof T.