typescript reduce initial value type

The solution for “typescript reduce initial value type” can be found here. The following code will assist you in solving the problem.

const { foo: I[], bar: U[] } = arr.reduce(
({ foo, bar }, current) => {
// stuff…
return { foo, bar };
}, { foo: [], bar: [] } as { foo: I[], bar: U[] }
);

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in