Let's say I've got array of objects:
let items = [
{ id: 1, name: 'one'},
{ id: 2, name: 'two'},
{ id: 3, name: 'three'},
];
Then I've got result object as index signature type:
let result: {[key: number]: string};
How can I map items
to result
using Array.prototype.map function?
I can't get the correct syntax for something like this:
result = array.map(elem => {[key: elem.id]: elem.name});