Giter Club home page Giter Club logo

Comments (6)

btroncone avatar btroncone commented on May 19, 2024 1

Hello,

It looks like you are calling it wrong. merge takes a variable number of observables, not an array. Try calling it like this:

const example = Rx.Observable.of(
 Rx.Observable.timer(1),
 Rx.Observable.timer(1),
 Rx.Observable.timer(1)
)

This should give you the correct behavior. 👍

from learn-rxjs.

ORESoftware avatar ORESoftware commented on May 19, 2024

thanks! :) hate to beat a horse, but why not allow for an array as well? I am sure I am not the only one to make such a mistake or to make the same request!

from learn-rxjs.

ORESoftware avatar ORESoftware commented on May 19, 2024

oh duh, if you allow for an array, it will return an array. Ughhh I think it's bad the way it is.

Rx.Observable.merge or Rx.Observable.of should return the same type, no matter what the input.

Right now Rx.Observable.merge will return an array, if an array is passed to it, and an Observable otherwise, that's pretty craytown TBH

from learn-rxjs.

btroncone avatar btroncone commented on May 19, 2024

I agree the behavior seems a little strange. I cannot speak to the intentions though, for that you will need to open up a ticket on official RxJS repo. Feel free to post a link here if you do. 👍

from learn-rxjs.

ORESoftware avatar ORESoftware commented on May 19, 2024

yeah thanks; I think in general with statically typed languages you can have overloaded functions/methods that return different types based off the input type, but with JS and no real overloaded methods/functions, it sure would make things easier if methods/functions always returned the same type

from learn-rxjs.

ORESoftware avatar ORESoftware commented on May 19, 2024

I did submit an issue, we will see what they say

ReactiveX/rxjs#2274

thanks!

from learn-rxjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.