JSFiddle - React, Tailwind, and code Playground
by Andrei Gheorghiu
TypeScript
const iconsMap: Map<string, string> = new Map([
['Roofs', 'roofs'],
['Walls', 'walls'],
['Windows & Doors', 'doors'],
['Heating & Controls', 'heating'],
['Ventilation & Air Tightness', 'ventilation'],
['Renewables', 'renewables'],
['Others', 'others'],
['Default', 'home'],
]);
interface Dictionary<T> {
[key: string]: T;
}
console.log(
Object.assign(
{} as Dictionary<string>,
...Array.from(iconsMap).map(
([label, fileName]) => ({ [label]: fileName })
)
)
);