“Store<ApplicationState>"类型中缺少属性“[Symbol.observable]"但在“Store<any, AnyAction>"类型中是必需的.TS2741 [英] Property &#39;[Symbol.observable]&#39; is missing in type &#39;Store&lt;ApplicationState&gt;&#39; but required in type &#39;Store&lt;any, AnyAction&gt;&#39;. TS2741

查看:30
本文介绍了“Store<ApplicationState>"类型中缺少属性“[Symbol.observable]"但在“Store<any, AnyAction>"类型中是必需的.TS2741的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新@react-material/core 后出现此错误,我不知道如何解决.

I've got this error after update @react-material/core, and I don't know how to resolve this.

我尝试更新 react-redux 和 redux-thunk 库,但没有成功.

I tried to update react-redux and redux-thunk libraries with no success.

这是我商店文件的一部分:

This is part of my store file:

const store = isDevMode
  ? createStore<ApplicationState>(
      rootReducer,
      initialState,
      composeEnhancers(applyMiddleware(...middleware)),
    )
  : createStore<ApplicationState>(
      rootReducer,
      initialState,
      applyMiddleware(...middleware),
    );

这是错误:

错误图片

我只是想解决这个问题以生成一个新版本.有什么想法吗?

I'm just trying to resolve this to generate a new version. Any ideas?

谢谢!

推荐答案

今天早上我遇到了这个问题.我尝试更新我的@types/react-redux,但没有任何运气.最终我只是将其添加为类型错误的解决方法:

I ran into this issue this morning. I tried updating my @types/react-redux, but wasn't having any luck. Eventually I just added this as a workaround to the type error:

  <Provider store={store as any}>
      <App />
  </Provider>

这篇关于“Store<ApplicationState>"类型中缺少属性“[Symbol.observable]"但在“Store<any, AnyAction>"类型中是必需的.TS2741的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆