Kala666

pick.ts

Apr 14th, 2021
1,238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {
  2.   return keys.reduce((x, key) => {
  3.     x[key] = obj[key];
  4.     return x;
  5.   }, {} as any);
  6. }
Advertisement
Add Comment
Please, Sign In to add comment