rxjsrxjs6

Where is RxJS 6 static merge?


In RxJS 6, how do I import a static merge function for merging a list of Observables?

I want to be able to do:

const merged$ = merge(
    obs1$,
    obs2$,
    obs3$
);

I've tried:

import { merge } from 'rxjs/observable/merge'; and

import { merge } from 'rxjs/operators';

but neither seems to give me what I want.


Solution

  • Importing has been made easy in RxJS 6:

     import { merge } from 'rxjs';
    

    You may want to read the official migration guide.

    Another useful resource regarding importing in RxJS 6 is this talk by Ben Lesh who is the RxJS lead.