I encountered a problem while trying to implement the logic for combining various types of iterables in a list, which includes Iterable
, Iterator
, AsyncIterable
, and AsyncIterator
. My goal is to combine them together to achieve the same output as RXJS's combineLatestWith.
You can find the source code here, and also in my documentation for the operator (link):
(Check out the complete playground link at the bottom)
function combineAsync<T>(iterable: AsyncIterable<T>, ...values: AnyIterable<T>[]): AsyncIterable<any[]> {
// Implementation code goes here
}
When passing 3 parameters: p1, p2(8), p3(7)
, defined as:
// Definitions of p1, p2, p3 go here
The expected result was:
[1, 2, 1]
[2, 2, 1]
// Remaining values truncated for brevity
Instead, I'm currently getting only part of the expected output.
I've spent considerable time debugging this complex asynchronous issue but haven't been able to solve it yet. If you have any insights or suggestions, they would be greatly appreciated!
Access the full playground here.
UPDATE
To demonstrate that the correct values do exist within the code, here's an updated version with added console logs.