类型'EpicMiddleware <action <any>,{},any,Action <any >>'不存在属性'run'

时间:2018-07-03 04:04:29

标签: typescript redux-observable

我尝试进行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)

0 个答案:

没有答案