Angular v6,rxjs v6 错误 TS2339:属性 'pipe' 在类型 'OperatorFunction 上不存在

Angular v6, rxjs v6 error TS2339: Property 'pipe' does not exist on type 'OperatorFunction

我已经将使用新的 pipe 方法与 Angular 5.5/rxJS5.5 一起工作的代码更新为使用 rxjs 的 Angular 6/rxJS6 -lint 包和以下命令

npm i -g rxjs-tslint
rxjs-5-to-6-migrate -p tsconfig.json

导入等已按预期进行了修改,但现在与 RxJS 的 Angular/5.5 的 v5 一起工作的代码出错并出现错误:

 error TS2339: Property 'pipe' does not exist on type 'OperatorFunction<{}, {} | RouterEvent | RouteConfigLoadStart | RouteConfigLoadEnd | ChildActivati...'.

我已经删除了 rxjs6-compat 包,但没有任何区别。就好像构建认为它拥有比 v5.5 更早的 rxJS 版本。 package.json 与 npm install 一起使用看起来像这样...

"dependencies": {
    "@angular/animations": "^6.0.2",
    "@angular/cdk": "^6.0.2",
    "@angular/common": "^6.0.2",
    "@angular/compiler": "^6.0.2",
    "@angular/core": "^6.0.2",
    "@angular/flex-layout": "^6.0.0-beta.15",
    "@angular/forms": "^6.0.2",
    "@angular/http": "^6.0.2",
    "@angular/material": "^6.0.2",
    "@angular/platform-browser": "^6.0.2",
    "@angular/platform-browser-dynamic": "^6.0.2",
    "@angular/router": "^6.0.2",
    "@ngrx/effects": "^6.0.0-beta.3",
    "@ngrx/entity": "^6.0.0-beta.3",
    "@ngrx/router-store": "^6.0.0-beta.3",
    "@ngrx/store": "^6.0.0-beta.3",
    "@ngrx/store-devtools": "^6.0.0-beta.3",
    "@ngx-translate/core": "^9.0.1",
    "core-js": "^2.5.2",
    "hammerjs": "^2.0.8",
    "lodash": "^4.17.4",
    "material-design-icons-iconfont": "^3.0.3",
    "nsp": "^3.2.1",
    "passport": "^0.4.0",
    "passport-azure-ad": "^3.0.12",
    "rxjs": "^6.1.0",
    "zone.js": "^0.8.26"
  },

rxjs 运算符的导入为 rxjs6 格式:

import { filter, map, merge, mergeMap } from 'rxjs/operators';

有效但现在出现此错误的语句是:

// Change page title on navigation or language change, based on route data
merge(this.translateService.onLangChange, onNavigationEnd)
  .pipe(
    map(() => {
      let route = this.activatedRoute;
      while (route.firstChild) {
        route = route.firstChild;
      }
      return route;
    }),
    filter(route => route.outlet === 'primary'),
    mergeMap(route => route.data)
  )
  .subscribe(event => {
    const title = event['title'];
    if (title) {
      this.titleService.setTitle(this.translateService.instant(title));
    }
  });

我错过了什么?为什么管道现在在 rxJS 5.5 没问题的地方导致这个错误?

替换

merge(this.translateService.onLangChange, onNavigationEnd).pipe(

有了这个

this.router.events.pipe(filter(event => event instanceof NavigationEnd), 
  map(() => {
    let route = this.activatedRoute;

你应该像这样导入合并:

import { merge } from 'rxjs';

应从 "rxjs/observable".

导入合并运算符

像这样

import { merge } from "rxjs/observable/merge";