1

I'm new to using npm and react inside Visual Studio. Tried to install Material-UI@next for my React project but got these warnings when running the project.

enter image description here

[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'.
...

enter image description here

Something obvious I am missing?

4
  • Are you using an AMD module loader (i.e. CommonJS or RequireJS)?... Commented Oct 17, 2017 at 19:51
  • No, I don't think so. I am using webpack to pack the js-files. The project is based on the Visual Studio template "React.js and Redux", and the only change I've made so far is adding Material-UI. Commented Oct 17, 2017 at 20:07
  • what version of visual studio? Commented Oct 17, 2017 at 20:23
  • Visual Studio Community 2017, Version 15.3.5 Commented Oct 17, 2017 at 20:34

1 Answer 1

2

I had the exact same issue getting the latest Material-UI working with .Net core's 'react/redux' template. I found it to be a matter of getting the correct versions of the dependencies in order.

In order to get it working, I updated all of the packages to the latest versions:

$ npm install -g npm-check-updates $ npm-check-updates -u $ npm install

Once I updated those refs, some of the sample code broke. So I simply removed the broken bits as all I cared about was getting Material-UI working.

Once I had that part, I just had to do the proper imports and was able to use the Paper element.

Here is an example of how I got it working.

https://github.com/cbehrends/MaterialUI_DotNetCore.git

Good Luck!

Edit: I've updated the repo and fixed any version issues I found. I'm going to try and keep this repo updated as best I can. Cheers!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.