Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce() overload invoked with index=undefined #2290

Closed
crunchie84 opened this issue Jan 17, 2017 · 3 comments · Fixed by #2291
Closed

Reduce() overload invoked with index=undefined #2290

crunchie84 opened this issue Jan 17, 2017 · 3 comments · Fixed by #2291
Labels
bug Confirmed bug

Comments

@crunchie84
Copy link
Contributor

RxJS version:
5.0.3
Code to reproduce:

Rx.Observable.from([1,2,3,4,5])
  .reduce((acc,curr,index) => `${acc}\ncurr:${curr}@index(${index})`, '')
  .subscribe(console.log);

Expected behavior:

curr:1@index(0)
curr:2@index(1)
curr:3@index(2)
curr:4@index(3)
curr:5@index(4)"

Actual behavior:

curr:1@index(undefined)
curr:2@index(undefined)
curr:3@index(undefined)
curr:4@index(undefined)
curr:5@index(undefined)"

Additional information:

The seed argument does not matter, results are the same

@kwonoj kwonoj added the bug Confirmed bug label Jan 17, 2017
@crunchie84
Copy link
Contributor Author

Note; the index argument is not documented in the documentation of RxJS5 (but was in RxJs4).

The code seems to suggest the overload should work: https://github.com/ReactiveX/rxjs/blob/master/src/operator/reduce.ts#L6-L8

@kwonoj
Copy link
Member

kwonoj commented Jan 17, 2017

Yes, there's mismatch between signature to implementation. Need to be update either case.

kwonoj added a commit to kwonoj/rxjs that referenced this issue Jan 17, 2017
benlesh pushed a commit that referenced this issue Jan 29, 2017
@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants