GuobaGuoba Utils

objectKeys

@guoba-ai/utils / object / objectKeys

Function: objectKeys()

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

Defined in: object.ts:19

Type-safe Object.keys.

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')[]

objectKeys({}) // []

objectKeys(Object.assign(Object.create({ hidden: true }), { visible: true }))
// ['visible']

On this page