typedash
Version:
modern, type-safe collection of utility functions
14 lines (11 loc) • 826 B
TypeScript
import { C as CastToString } from '../CastToString-BoaHrryS.js';
import { K as KeysOfUnion } from '../KeysOfUnion-BrkZWXzm.js';
declare const objectEntries: ObjetEntries;
/**
* Returns an array of a given object's own enumerable string-keyed property [key, value] pairs, in the same order as that provided by a for...in loop. (The only important difference is that a for...in loop enumerates properties in the prototype chain as well.)
* Same as `Object.entries()` but returns a typed array.
* @param object An object whose enumerable own property [key, value] pairs are to be returned.
* @returns An array of the given object's own enumerable string-keyed property [key, value] pairs.
*/
type ObjetEntries = <T extends object>(object: T) => Array<[CastToString<KeysOfUnion<T>>, T[keyof T]]>;
export { objectEntries };