Pick Keys from an Object, Typed
Write the code, see it run, pass the checks.
The problem
- easy
- Code
Write pick(obj, keys): return a new object with only the listed keys of obj (keys missing from obj are left out). Type it so the result has exactly the picked properties, and so asking for a key obj doesn't have is a type error.
Your code must pass
- Keeps only the listed keys
- Leaves obj unchanged
- Has no type errors
- Returns exactly the picked properties
- Rejects a key the object doesn't have