Search code examples
angularrxjstslintrxjs-pipeable-operators

How to import RxJS merge?


In my Angular (v10) project I can import all kinds of RxJS (v6.6.2) operators like

import { debounceTime, filter, map, ... and so on } from 'rxjs/operators';

except merge. merge I import like

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

but I think it's not the proper way doing it. I could also write

import { merge } from 'rxjs';

but it's prohibited by a suggested blacklist rule for tslint:

"import-blacklist": [true, "rxjs", "rxjs/Rx"]

What's the right way importing merge?


Solution

  • Merge is not an operator function, it's rather an Observable creator function and as such, it should be imported just like from, of or forkJoin (all of which are meant for creating new Observables rather than operating on exiting ones)