Skip to content

Pick in Typescript

Posted on:June 7, 2023 at 02:31 AM
type Pick2<T, P extends keyof T> = {
  [K in P]: T[K];
};

type AB = {
  name: String;
  c: string;
};

type C = Pick<AB, "name" | "c">;