Is there a way to set the return value for my reducer in TypeScript? I am looking to achieve: Instead of using 'any', what should I assign as the type for acc? How can I define my return type so that the output will be {temp: 60, temp: 60}?
return array.reduce((acc, curr: string): any => {
const key = 'temp';
acc[key] = 60;
return acc;
}, {});
Although I realize that the key and value are constant every iteration. I'm just using this as an illustration at the moment.