小编Arc*_*yal的帖子

参数“action”和“action”的类型在 Angular ngrx 商店项目中不兼容

我正在使用 Angular 创建我的第一个 NGRX 项目,并遵循本教程(请在此处找到所有文件代码)。

当我在 app.mdule.ts 中声明减速器时,我遇到了这个编译错误。

Type '(state: Tutorial[] | undefined, action: Actions) => Tutorial[]' is not assignable to type 'ActionReducer<Tutorial[], Action>'.
  Types of parameters 'action' and 'action' are incompatible.
    Type 'Action' is not assignable to type 'Actions'.
      Property 'payload' is missing in type 'Action' but required in type 'RemoveTutorial'.
22       **tutorial: reducer**
         ~~~~~~~~
  src/app/actions/tutorial.actions.ts:20:17
    20     constructor(public payload: Tutorial) { }
                       ~~~~~~~~~~~~~~~~~~~~~~~~
    'payload' is declared here.
Run Code Online (Sandbox Code Playgroud)
 imports: [
    BrowserModule,
    AppRoutingModule,
    StoreModule.forRoot({
      tutorial: reducer ///this line is …
Run Code Online (Sandbox Code Playgroud)

web typescript ngrx angular ngrx-store

3
推荐指数
1
解决办法
2394
查看次数

标签 统计

angular ×1

ngrx ×1

ngrx-store ×1

typescript ×1

web ×1