API reference / @evolu/common / Object / objectToEntries
Function: objectToEntries()
function objectToEntries<T>(
record,
): readonly [Extract<keyof T, string>, T[Extract<keyof T, string>]][];
Defined in: packages/common/src/Object.ts:38
Like Object.entries but preserves branded keys.
Example
type UserId = string & { readonly __brand: "UserId" };
const users = createRecord<UserId, string>();
const entries = objectToEntries(users); // [UserId, string][]
Type Parameters
| Type Parameter |
|---|
T extends Record<string, any> |
Parameters
| Parameter | Type |
|---|---|
record | T |
Returns
readonly [Extract<keyof T, string>, T[Extract<keyof T, string>]][]