DEV Community

Discussion on: TypeScript: adjusting types in reduce function with an async callback

Collapse
arnaudcourtecuisse profile image
Arnaud Courtecuisse

Another alternative, that I use :

const final = await arr.reduce(async (promise, key) => { 
  const partial = await promise
  partial[key] = await asyncFn(key)
  return partial
}, {})
Enter fullscreen mode Exit fullscreen mode