Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. function pluck<T, K extends keyof T>(source: T, key: K): Record<K, T[K]> {
  2. return { [key]: source[key] } as Record<K, T[K]>;
  3. }
  4.  
  5. function pluck<T, K extends keyof T>(source: T, key: K): Pick<T,K> {
  6. return { [key]: source[key] } as Pick<T,K>;
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement