UNPKG

typedash

Version:

modern, type-safe collection of utility functions

1 lines 1.02 kB
{"version":3,"file":"objectKeys-DdwARfHf.cjs","names":[],"sources":["../src/functions/objectKeys/objectKeys.ts"],"sourcesContent":["import type { KeyAsString } from 'type-fest';\n\nimport type { AnyFunction } from '../../types/_internal';\n\nexport const objectKeys: ObjectKeys = Object.keys;\n\n/**\n * Returns an array of a given object's own enumerable property names, iterated in the same order that a normal loop would.\n * Same as `Object.keys`, but with typed keys.\n * @param object An object to get the keys of.\n * @returns An array of strings that represent all the enumerable properties of the given object.\n * @note The type of the object is inferred from the type of the `object` parameter, so if that's incorrect/incomplete\n * more keys might be returned than actually exist on the object. See https://github.com/Microsoft/TypeScript/issues/12870 for more info.\n */\ntype ObjectKeys = <T extends object>(\n object: Exclude<T, AnyFunction>\n) => KeyAsString<T>[];\n"],"mappings":";;AAIA,MAAa,aAAyB,OAAO"}