This is an example of a very common Node.js design pattern: a serial asynchronous iteration over a collection (array) using callbacks.
If you are interested in learning more about common (and even less common!) Node.js design patterns, you should check out the book Node.js Design Patterns by Mario Casciaro and Luciano Mammino (spoiler alert: that's me :P):
https://www.nodejsdesignpatterns.com/
To run the example:
- Download the two files (
test.jsanditerateSeries.js) into a folder - From your command line run
node test
Nice one. I am no TS expert but I'd be curious to know if you also tried to do that callback vs promise inference using
infer...