Error rxjs_Observable__.Observable.forkJoin is not a function?

For RxJS v6.5+, it is now:

import { forkJoin } from 'rxjs';

https://www.learnrxjs.io/operators/combination/forkjoin.html


As explained here, you have two options:

  1. Either import all operators as a single package
  2. Or import each operator individually

In the first case you would use import like this:

import Rx from 'rxjs/Rx';

Rx.Observable.forkJoin(1,2,3)

In the second like this:

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/forkJoin';

I believe what you're looking for is the second option.


Use the forkJoin Operator as a function by importing forkJoin instead of importing Observable.
Use forkJoin.subscribe() in place of Observable.forkJoin.subscribe()

import { forkJoin } from 'rxjs/observable/forkJoin'

export class ViewerComponent implements OnInit, AfterViewInit, OnDestroy {
    someFunction(someArg){
      let someArray: any = [];
      forkJoin(someArray).subscribe(data => {
      });
    }
}

Source Code : https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/forkJoin.ts