2
votes

I'm using Material-UI with typescript, I've installed the typescript types with

npm install -D @types/material-ui.

When my webpage loads now I get the following errors:

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

There are absolutely no other changes to my project besides the addition of material-ui to node_modules which isn't even imported, the issue is likely coming from its types import.

So I came up with a very hacky solution where I added "noImplicityAny":false to my tsconfig.json. This does not actually fix the issue though and I would appreciate a proper fix.

2
you can simply use typescript without installing any external plugin i guess, isn't it ?Pardeep Jain
if you are using V1 beta.8 you just install the package. Make sure you uninstall the @types though or you will have conflicts. You might want to show more of your code. Tsconfig? webpack? +mjwrazor

2 Answers

0
votes

I think you need upgrade to the latest version of @types/react.

-1
votes

I had the same issue and I found it's caused by the global.d.ts file missing in the node_modules/@types/react folder.

After manually running

npm install @types/react --save

it's fixed.