【发布时间】:2020-03-24 00:30:36
【问题描述】:
当我尝试运行以下代码时:
functionMap = {
[ActionTypeEnum.TYPE_FIRST.toLowerCase()]:[getInitialDataStatus({statusType: 'disabled'}),fetchImportantDataFirst()],
[ActionTypeEnum.TYPE_SECOND.toLowerCase()]:[getInitialDataStatus({}),
fetchImportantDataSecond()],
[ActionTypeEnum.TYPE_THIRD.toLowerCase()]:[getInitialDataStatus({}),
fetchImportantDataThidr()]
}
startMultpileActionDepensOnType$ = createEffect(() => this.actions$.pipe(
ofType(startMultpileActionDepensOnType),
withLatestFrom(this.store$.select(selectTypeActions)),
map(([action, select]) => {
const actionType = select.type.toLowerCase();
return this.unctionMap[actionType]
}
)
));
我收到以下错误:
TS2322: Type 'Observable<TypedAction<string>[]>' is not assignable to type 'Observable<Action>'. Property 'type' is missing in TypedAction<string>[].
但是当我改为:functionMap:{},
我得到了错误:
Action must have a type property
【问题讨论】:
标签: angular typescript rxjs ngrx effect