Utility types with generics
Adding a keyof constraint so Pick works inside a generic function.
Codetypescript
function pluck<T, K>(obj: T, keys: K[]): Pick<T, K> {
const result = {} as Pick<T, K>;
for (const k of keys) {
result[k] = obj[k];
}
return result;
}What is the bug in this code?