【发布时间】:2017-10-17 19:47:46
【问题描述】:
我不熟悉使用 npm 并在 Visual Studio 中做出反应。尝试为我的 React 项目安装 Material-UI@next,但在运行项目时收到这些警告。
[at-loader] ./node_modules/material-ui/ButtonBase/ButtonBase.d.ts:12:11
TS2694: Namespace 'React' has no exported member 'ButtonHTMLAttributes'.
[at-loader] ./node_modules/material-ui/ButtonBase/ButtonBase.d.ts:13:9
TS2694: Namespace 'React' has no exported member 'AnchorHTMLAttributes'.
[at-loader] ./node_modules/material-ui/Chip/Chip.d.ts:4:18
TS2430: Interface 'ChipProps' incorrectly extends interface 'HTMLAttributes<HTMLDivElement>'.
Types of property 'label' are incompatible.
Type 'ReactNode' is not assignable to type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'.
[at-loader] ./node_modules/material-ui/Form/FormControl.d.ts:5:17
TS2694: Namespace 'React' has no exported member 'HtmlHTMLAttributes'.
[at-loader] ./node_modules/material-ui/Form/FormControlLabel.d.ts:13:11
TS2694: Namespace 'React' has no exported member 'LabelHTMLAttributes'.
...
我遗漏了什么明显的东西?
【问题讨论】:
-
您是否使用 AMD 模块加载器(即 CommonJS 或 RequireJS)?...
-
不,我不这么认为。我正在使用 webpack 来打包 js 文件。该项目基于 Visual Studio 模板“React.js 和 Redux”,到目前为止我所做的唯一更改是添加 Material-UI。
-
什么版本的visual studio?
-
Visual Studio 社区 2017,版本 15.3.5
标签: visual-studio reactjs material-ui