Function: select()
select<
T,K>(obj,keys):Pick<T,K>
Defined in: object.ts:69
Returns a new object containing only the specified properties of the given object.
Type Parameters
T
T extends object
K
K extends string | number | symbol
Parameters
obj
T
The source object.
keys
K[]
The property names to include.
Returns
Pick<T, K>
A new object with only the selected properties.
Example
ts
select({ a: 1, b: 2, c: 3 }, ['a', 'c']) // { a: 1, c: 3 }