小编bni*_*yer的帖子

将 NgRx 和 Angular 升级到版本 7 后无法编译

我正在将使用 NgRx 的 Angular 应用程序从版本 6.1.3 升级到 7.2.15。运行后ng-update我的版本升级如下:

角度 - 6.1.3 -> 7.2.15

NgRx - 6.1.0 -> 7.4.0

RxJS - 6.2.2 -> 6.5.2

rxjs-compat(第三方组件需要) - 6.2.2 -> 6.5.2

在升级编译失败并返回以下错误的变体后,尝试构建或提供应用程序时,对于所有使用选择器的地方:

  Types of parameters 'source$' and 'source' are incompatible.
    Type 'Observable<MyFeatureState>' is not assignable to type
src/app/my-feature/detail/detail.component.ts(84,45): error TS2345: Argument of type '(source$: Observable<State>) => Observable<DetailMetadata[]>' is not assignable to parameter of type 'OperatorFunction<MyFeatureState, DetailMetadata[]>'.
Run Code Online (Sandbox Code Playgroud)

我没有使用任何非常复杂的选择器。大多数只是直接从功能商店获取值,并且应用程序在升级之前就可以运行。作为其中一个组件的(简化)示例,错误指向:

  Types of parameters 'source$' and 'source' are incompatible.
    Type 'Observable<MyFeatureState>' is not assignable to …
Run Code Online (Sandbox Code Playgroud)

ngrx angular-cli angular angular7

4
推荐指数
1
解决办法
691
查看次数

标签 统计

angular ×1

angular-cli ×1

angular7 ×1

ngrx ×1