Typed alternative to Object.fromEntries() that preserves output shape.
Object.fromEntries()
Key-value pairs to assemble into an object.
An object whose keys and value types are inferred from the entries tuple.
entries
const entries = [ ["foo", 1], ["bar", "hello"],] as const;const rebuilt = typedFromEntries(entries);// ^? { foo: number; bar: string } Copy
const entries = [ ["foo", 1], ["bar", "hello"],] as const;const rebuilt = typedFromEntries(entries);// ^? { foo: number; bar: string }
Typed alternative to
Object.fromEntries()that preserves output shape.