我尝试进行createEpicMiddleware剂量时遇到此ts错误。不知道我在做什么错。从早上开始,我一直在从事此工作,我们将不胜感激。
const epicMiddleware = createEpicMiddleware({
dependencies: { ... }
});
let middleware: Middleware[] = [];
middleware.push(epicMiddleware);
...
export const configureStore = (initialState: object): Store<IStore> => {
const store = createStore(
rootReducer,
initialState,
applyMiddleware(...middleware)
);
epicMiddleware.run(rootEpic);
return store;
};
这是我遇到的错误,
Property 'run' does not exist on type 'EpicMiddleware<Action<any>, {}, any, Action<any>>'.
当我将epicMiddleware
的类型更改为any
时,它将引发运行时错误You must provide a root Epic to createEpicMiddleware
P.S。我正在使用最新版本的redux-observable
(1.0.0)