Javascript – Typescript type for converting array of objects to an object with keys in array objects
interface Item { slug: string; description: string; } interface Params { id: number; items: Item[]; } function test(params: Params) { const result = {}; for (const item of params.items) { result[item.slug] = "Hello"; } return result; } const data =…