Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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[] }
);
 
PREVIOUS NEXT
Tagged: #typescript #reduce #initial #type
ADD COMMENT
Topic
Name
3+9 =