pickProps()function
pickProps(obj: T, ...keys: K[]): Pick<T, K>
| Param | Type | |
|---|---|---|
obj | T | The object to pick the props from. required |
keys | K[] | The keys of the props to pick. required |
| Return | |
|---|---|
Pick<T, K> | A new object containing only the picked props. |
Pick several props from an object and return a new object with only those props.
Examples
pickProps({ a: 1, b: 2, c: 3 }, "a", "b"); // { a: 1, b: 2 }