You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeMyPick<Textendsobject,KextendskeyofT>={[PinK]: T[P]};typeAgeOnly=MyPick<Person,'age'>;// ^? type AgeOnly = { age: number; }typeFirstNameOnly=MyPick<Person,'firstName'>;// ~~~~~~~~~~~// Type '"firstName"' does not satisfy the constraint 'keyof Person'.typeFlip=MyPick<'age',Person>;// ~~~~~ Type 'string' does not satisfy the constraint 'object'.
/** * Construct a new object type using a subset of the properties of another one * (same as the built-in `Pick` type). * @template T The original object type * @template K The keys to pick, typically a union of string literal types. */typeMyPick<Textendsobject,KextendskeyofT>={[PinK]: T[P]};