【问题标题】:Type 'ReactType' is not generic (material-ui@next)类型“ReactType”不是通用的(material-ui@next)
【发布时间】:2018-06-17 07:52:06
【问题描述】:

我安装了材料 ui@next,我在节点模块中出现了这个错误。

ERROR in [at-loader] ./node_modules/material-ui/Avatar/Avatar.d.ts:8:15 11:31:52 web.1 | TS2315: Type 'ReactType' is not generic. 11:31:52 web.1 | ERROR in [at-loader] ./node_modules/material-ui/Button/Button.d.ts:7:15 11:31:52 web.1 | TS2315: Type 'ReactType' is not generic. 11:31:52 web.1 | ERROR in [at-loader] ./node_modules/material-ui/ButtonBase/ButtonBase.d.ts:10:15 11:31:52 web.1 | webpack: Failed to compile.

【问题讨论】:

    标签: javascript node.js forms reactjs material-ui


    【解决方案1】:

    做一个npm update @types/react。 在最新版本中 ReactType 是通用的

    【讨论】:

    • 谢谢,这对我有帮助。更具体地说,因为我在桌子上撞了大约 40 分钟试图解决这个问题,这里是我更新的包:@types/react、@types/react-dom、react 和 react-dom 设置为版本16.0.34、@types/react-router-dom 和 react-router-dom 设置为 4.2.2,@types/react-router 在 package.json 中设置为 4.2.0。然后我清除了node_modules 并重新安装,然后运行npm upgrade 进行了很好的衡量。它奏效了,虽然可能有点矫枉过正。
    【解决方案2】:

    我通过删除我的node_modules 文件夹和我的yarn.lock 文件来解决此问题,然后使用yarn(或npm i)重新安装模块。

    重新安装后,我有一个更新版本的 react 和 @types/react,它解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2018-10-06
      • 2018-08-30
      • 2017-09-12
      • 1970-01-01
      • 2018-09-25
      • 1970-01-01
      • 2018-04-29
      • 2018-01-19
      • 2018-04-21
      相关资源
      最近更新 更多