@spark-web/utils
Version:
--- title: Utilities isExperimentalPackage: true ---
11 lines (10 loc) • 326 B
TypeScript
/**
* An alternative to `Object.keys()` that avoids type widening.
*
* @param {object} value Object containing keys to extract
*
* @example
* Object.keys({ foo: 1, bar: 2 }) // string[]
* typedKeys({ foo: 1, bar: 2 }) // ("foo" | "bar")[]
*/
export declare function typedKeys<T extends object>(value: T): (keyof T)[];