It would be useful to add a strongly-typed version of Object.values().
How Object.values is defined:
values<T>(o: { [s: string]: T; } | ArrayLike<T>): T[];
How objectValues could be defined:
export const objectValues = Object.values as <Type extends object>(value: Type) => Array<Required<Type>[ObjectKeys<Type>]>;
Also objectKeys and objectEntries definitions should be synchronized:
// Notice "Type extends Record<PropertyKey, unknown>". This definition rejects interfaces.
export const objectEntries = Object.entries as <Type extends Record<PropertyKey, unknown>>(value: Type) => Array<[ObjectKeys<Type>, Required<Type>[ObjectKeys<Type>]]>;
// Notice "Type extends object". This definition accepts interfaces.
export const objectKeys = Object.keys as <Type extends object>(value: Type) => Array<ObjectKeys<Type>>;
I would suggest changing objectEntries definition to "Type extends object" to allow passing interfaces, because I see no point in rejecting them, we are not making these calls safer by rejecting them (with or without allowing interfaces we are doing the same unsafe things https://stackoverflow.com/questions/55012174/why-doesnt-object-keys-return-a-keyof-type-in-typescript).
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too