PronounsPage/utils/withKey.ts
2025-04-22 14:29:10 +02:00

6 lines
193 B
TypeScript

export type WithKey<T> = T & { key: string };
export default <T>(record: Record<string, T>): WithKey<T>[] => {
return Object.entries(record).map(([key, value]) => ({ ...value, key }));
};