Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Latest commit

 

History

History
23 lines (18 loc) · 434 Bytes

pick.md

File metadata and controls

23 lines (18 loc) · 434 Bytes

获取部分属性集合

Pick<T, K extends keyof T>

举例

interface O1 {
  a: string | number;
  b: object;
  c: boolean;
  d?:  number;
}

type O2 = MyPick<O1, 'a' | 'd'>;
// O2 =>  {
//   a: string | number;
//   d?:  number;
// }