pickProps()function

pickProps(obj: T, ...keys: K[]): Pick<T, K>
ParamType
objT
The object to pick the props from. required
keysK[]
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 }