-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Rx.Observable.merge should return same type regardless of input #2274
Comments
If you pass it a single array argument you would hit this conditional, which would just return the If you want to use it with an array you need to destructure it, the following should work: var example = Rx.Observable.merge(...[
Rx.Observable.timer(1),
Rx.Observable.timer(1),
Rx.Observable.timer(1)
]); |
ok so here is the thing: if it doesn't currently accept an array (which seems clear) - it should accept an array, because it obviously should given the arguments it accepts; but if the API really really can't accept an array, then it should throw an error IMO. if it does accept an array, then please make the return value consistent, in this case, an Observable I like TypeScript and am using it to interface with RxJS in some case, but in other cases I am interfacing with RxJS with plain JS and nothing is really stopping me from passing an array to the merge method etc. It would help if: (a) it allowed for arrays, (which it really should) my 2 cents |
I'll use #2153 as umbrella issue to discuss runtime validations. |
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. |
btroncone/learn-rxjs#26 (comment)
Mr. btroncone and I are both curious and concerned about the API for
Rx.Observable.merge
-it seems to return different types based off the input, which is at the very least confusing.
You can see the difference when comparing
Rx.Observable.of
withRx.Observable.merge
, see code below.RxJS version:
5.0.2
Code to reproduce:
The output is:
Expected behavior:
Actual behavior:
Additional information:
Maybe there is a good reason for this, but it seem bad on the face of things
The text was updated successfully, but these errors were encountered: