Typed alternative to Object.entries() that preserves key/value tuples.
Object.entries()
Object whose own enumerable entries to collect.
[key, value] tuples with preserved keyof/value types instead of [string, any][].
[key, value]
[string, any][]
const obj = { foo: 1, bar: "hello" };const entries = typedEntries(obj);// ^? (["foo", number] | ["bar", string])[] Copy
const obj = { foo: 1, bar: "hello" };const entries = typedEntries(obj);// ^? (["foo", number] | ["bar", string])[]
Typed alternative to
Object.entries()that preserves key/value tuples.