Closed vitaly-t closed 1 year ago
Closing, for now, because it creates questions like - should the initial value support a promise then also?
It does create some ambiguities, hence the reason why it wasn't supported from start.
@RebeccaStevens This one is actually a good exercise for the brain, and a worthy addition :wink:
So I am re-opening it.
Again, I'm just not sure what this bears for the initial value - should it allow passing in a promise also? This needs to be investigated.
b.t.w. what prompted me to get back to this was this recent question.
I think that in terms of functionality, all it takes is to replace this line in async version:
return this.next();
with this one:
return isPromiseLike(value) ? value.then(() => this.next()) : this.next();
And that's it.
However, in terms of function signature types update, that's where I'm lost. I tried a few things, but they didn't look right. so I figured I'd leave the joy of types to yourself, as you are the expert in types resolution, to figure out how to update the signature properly...
@RebeccaStevens
Most of operators that provide a callback support async result from it, where it may be useful.
There maybe cases when
reduce
could benefit from handling async callbacks also.