Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix the following error? property 'pipe' does not exist on type OperatorFunction

I wrote the following code following RxJS 6 documentation. I'm currently running angular 5, RxJS 6 and angularfire2 rc.10. The error I get is

[ts] property 'pipe' does not exist on type 'OperatorFunction<{}, [{}, user, string]>'.

This is the code

this.companies$ = combineLatest(this.authService.user$, this.filter$).pipe(
  switchMap(([user, filter]) =>
    this.afs.collection("companies", ref => {
        if (user) {
          ref.where("owner.network", "==", user.activeNetworkProfile.id);
        }
        if (user) {
          ref.where("name", "==", filter);
        }
        return ref;
      }).valueChanges()
  )
);

this.authService.user$ and this.filter$ are observables.

public filter$: Observable<string>;
public user$ : Observable<User>;
like image 995
Noober Avatar asked Jun 16 '18 08:06

Noober


1 Answers

You haven't shown your import statements, but from the look of the error message, it seems you're importing the wrong combineLatest function.

RxJS6 has two combineLatest functions:

  • a pipeable operator: import {combineLatest} from 'rxjs/operators'
  • a creation method: import { combineLatest } from 'rxjs'

You're using the creation method, so the import should from 'rxjs' and not from 'rxjs/operators'.

like image 70
Wayne Maurer Avatar answered Sep 29 '22 23:09

Wayne Maurer