typescript reduce initial value type code example
Example: typescript reduce initial value type
const { foo: I[], bar: U[] } = arr.reduce(
({ foo, bar }, current) => {
// stuff...
return { foo, bar };
}, { foo: [], bar: [] } as { foo: I[], bar: U[] }
);