Reactive-Extensions / RxJS

The Reactive Extensions for JavaScript
http://reactivex.io
Other
19.48k stars 2.1k forks source link

Rx.Observable.prototype.manySelect() error behavior #1358

Open manbaum opened 8 years ago

manbaum commented 8 years ago

The following code is adaped from What does the new ManySelect operator do?

var projection = ["a", "b", "c"];
var count = 0;
Rx.Observable.range(1, 3)
  .do(Rx.Observer.create(
    x  => console.log(`Generate Next ${x}`),
    e  => console.log(`Generate Error ${e.message}`),
    () => console.log(`Generate Completed`)
  ))
  .manySelect(ys => {
    var k = ++count;
    return ys.map(x => `${k}, ${projection[x - 1]}`);
  })
  .mergeAll()
  .subscribe(Rx.Observer.create(
    x  => console.log(`Next ${x}`),
    e  => console.log(`Error ${e.message}`),
    () => console.log(`Completed`)
  ));

According to the documentation of manySelect(), the code above should produce the output like below:

"Generate Next 1"
"Generate Next 2"
"Next 1, a"
"Generate Next 3"
"Next 1, b"
"Next 2, b"
"Generate Completed"
"Next 1, c"
"Next 2, c"
"Next 3, c"
"Completed"

But actually, it gives the following result:

"Generate Next 1"
"Next 1, a"
"Generate Next 2"
"Error innerSource.subscribe is not a function"