GuobaGuoba Utils

objectKeys

@guoba-ai/utils / object / objectKeys

Function: objectKeys()

function objectKeys<T>(obj): keyof T[];

Defined in: object.ts:14

Type-safe Object.keys.

Type Parameters

T

T extends object

Parameters

obj

T

The object to get keys from

Returns

keyof T[]

An array of the object's own enumerable keys

Example

objectKeys({ a: 1, b: 2 }) // ['a', 'b'] typed as ('a' | 'b')[]

On this page