Write a generic pick(obj, keys) that returns a new object containing only the given keys.
Signature: pick<T, K extends keyof T>(obj: T, keys: K[]) => Pick<T, K>
Practice using a generic T for the object and K extends keyof T so only real keys are allowed and the return type is Pick<T, K>.
Type the keys as K extends keyof T so callers can only pass real keys.
Build the result by reducing over keys, copying each from obj.
Return type is Pick<T, K>.
Test natijalarini ko'rish uchun kodingizni ishga tushiring.