错误在于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",
答案 0 :(得分:1)
withLastFrom()实际上返回一个元组类型,并声明元组中每个元素的类型,我们需要做类似的事情
map(([action, store]: [DataActions.AddDataAction, AppState])=>