Creates a type by picking a set of properties from T whose keys are in union K. This is a relaxed version that filters out invalid keys automatically.
T
K
The object type to pick from.
The union of keys to pick.
An object type with only the valid specified properties.
type Person = { name: string; age: number; email: string };type BasicInfo = RelaxedPick<Person, 'name' | 'age' | 'invalid'>; // { name: string; age: number }type Empty = RelaxedPick<Person, 'nonexistent'>; // {} Copy
type Person = { name: string; age: number; email: string };type BasicInfo = RelaxedPick<Person, 'name' | 'age' | 'invalid'>; // { name: string; age: number }type Empty = RelaxedPick<Person, 'nonexistent'>; // {}
Creates a type by picking a set of properties from
Twhose keys are in unionK. This is a relaxed version that filters out invalid keys automatically.