@stryke/helpers
Version:
A package containing miscellaneous helper functions that are used across many different Storm Software projects.
19 lines (18 loc) • 674 B
TypeScript
/**
* Creates a new object composed of the picked object properties.
*
* This function takes an object and an array of keys, and returns a new object that
* includes only the properties corresponding to the specified keys.
*
* @param obj - The object to pick keys from.
* @param keys - An array of keys to be picked from the object.
* @returns A new object with the specified keys picked.
*
* @example
* ```typescript
* const obj = { a: 1, b: 2, c: 3 };
* const result = pick(obj, ['a', 'c']);
* // result will be { a: 1, c: 3 }
* ```
*/
export declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K>;