2

错误是说它action.map.

悬停在上面时也会出现DataActions.AddDataAction错误Tuple type '[Action, AppStore]' with length '2' cannot be assigned to tuple with length '5'

@Effect() addData$ = this.actions$
    .ofType(DataActions.ADD_DATA)
    .withLatestFrom(this.store$)
    .map(([action: DataActions.AddDataAction, store: AppState]) => [action.payload, reducer.dataResults(store)])
    .etc...

这是我的相关软件包及其版本package.json

"@ngrx/effects": "^4.1.1",
"@ngrx/router-store": "^4.1.1",
"@ngrx/store": "^4.1.1",
"@ngrx/store-devtools": "^4.1.1",
"typescript": "~2.4.0",
4

1 回答 1

2

withLastFrom() 实际上返回一个元组类型并声明元组中每个元素的类型,我们需要执行类似的操作

map(([action, store]: [DataActions.AddDataAction, AppState])=> 
于 2018-09-25T01:52:49.803 回答