gpt4 book ai didi

visual-studio - 命名空间 'React' 没有导出成员 'InputHTMLAttributes' 和接口(interface) 'MenuItemProps' 错误地扩展了接口(interface) 'ListItemProps'

转载 作者:搜寻专家 更新时间:2023-10-30 22:03:26 28 4
gpt4 key购买 nike

我正在使用带有 typescript 的 Material-UI,我已经安装了带有

的 typescript 类型

npm install -D @types/material-ui.

现在当我的网页加载时,出现以下错误:

ERROR in [at-loader] ./node_modules/@types/material-ui/index.d.ts:1235:26 TS2430: Interface 'MenuItemProps' incorrectly extends interface 'ListItemProps'. Types of property 'label' are incompatible. Type 'ReactNode' is not assignable to type 'string | undefined'. Type 'null' is not assignable to type 'string | undefined'.

ERROR in [at-loader] ./node_modules/@types/material-ui/index.d.ts:1491:69 TS2694: Namespace 'React' has no exported member 'InputHTMLAttributes'.

除了向 node_modules 添加 material-ui 之外,我的项目绝对没有其他更改,甚至没有导入,问题可能来自其类型导入。

所以我想出了一个非常 hacky 的解决方案,我将 "noImplicityAny":false 添加到我的 tsconfig.json 中。虽然这实际上并不能解决问题,但我希望得到适当的修复。

最佳答案

我认为你需要升级到最新版本的@types/react。

关于visual-studio - 命名空间 'React' 没有导出成员 'InputHTMLAttributes' 和接口(interface) 'MenuItemProps' 错误地扩展了接口(interface) 'ListItemProps',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46153426/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com