【发布时间】:2021-06-08 03:56:09
【问题描述】:
我在 Redux Observable 中收到以下错误。 我该如何解决这个问题?
类型参数 'OperatorFunction
export interface ITodo {
id: number;
title: string;
}
interface IPayloadAction extends Action {
type: string;
payload?: any;
}
const todoFetchEpic: Epic<IPayloadAction> = (actions$) =>
actions$.pipe(
ofType(todoActions.fetch.started.type),
mergeMap((action: IPayloadAction) =>
concat(
of(todoActions.loading({ isLoading: true })),
ajax.getJSON(action.payload.url).pipe(
map((todos: ITodo[]) =>
todoActions.fetch.done({
params: action.payload.url,
result: {todos}
})
),
catchError((_) =>
of(
todoActions.fetch.failed({
params: action.payload.url,
error: { hasError: true },
})
)
)
),
of(todoActions.loading({ isLoading: false }))
)
)
);
【问题讨论】:
标签: typescript redux redux-observable