I often need to pluck properties out of an object
const obj = {a:1, b: 2, c: 3}; const plucked = pluck(obj, \'a\', \'b\'); // {a: 1, b:2}
Howev
Here's an alternative option:
function pluck(objs: T, keys: K[]): Pick { return keys.reduce((result, key) => Object.assign(result, {[key as string]: objs[key]}), {}) as Pick; }