I’m trying to use reduce to create a dictionary from an array. However I run into a flow error property is missing in object literal [1] when using reduce to create a dictionary from an array. This happens for all three keys ‘A’, ‘B’, and ‘C’.
const foo = [
'A',
'B',
'C',
];
const bar = foo.reduce((acc, curr) => {
// the actual code will do some logic on the string value in foo
// but for the test just create a dictionary of the key to itself as value
acc[curr] = curr;
return acc;
}, {});