[x] I tried using the @types/material-ui package version @types/[email protected]and had problems.
Used with Typescript 2.3.4
Authors: @andy-ms, @allienna, @vincealdrin
node_modules/@types/material-ui/index.d.ts(1169,19): error TS2430: Interface 'MenuItemProps' incorrectly extends interface 'ListItemProps'.
Types of property 'label' are incompatible.
Type 'ReactNode' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
node_modules/@types/material-ui/index.d.ts(1419,62): error TS2694: Namespace 'React' has no exported member 'InputHTMLAttributes'.
I was able to resolve this issue by updating @types/react to the latest version.
My package.json beforehand: "@types/react": "^15.0.25",
Now: "@types/react": "^15.0.38",
I know for certain that I didn't have 15.0.38 installed beforehand, however I may have had something slightly newer than 15.0.25 installed but I'm not sure (all I know for sure is what my git diff is telling me about the package.json file).
There have been big breaking recent changes in @types/react, I believe starting at 15.0.36.
Consider modifying the package.json @types/react dependency to be a little crisper, version-wise; it currently reads:
"@types/react": "*"
It should perhaps specify
"@types/react": "^15.0.36 ^16.0.0"
Sorry, I'm not confident enough of my semver understanding or my understanding of the problem to PR this. Also, because of the current state of React being near a major release, it may make sense to make it a peer dependency, so an install of @types/material-ui doesn't drag in the wrong major version of @types/react if none is already there.
Is this issue solved? I just tried to use latest npm package for material-ui and I get the same error message:
_TS2430: Interface 'MenuItemProps' incorrectly extends interface 'ListItemProps'._
My package.json contains following react and material packages:
"@types/material-ui": "^0.18.1"
"@types/react": "15.0.35"
"react": "15.6.1"
"material-ui": "^0.19.2"
I just need confirmation, whether this is solved or not with the latest package?
@negyxo It should be fixed if you upgrade to the latest version of @types/react.
Thanks Andy,
It seems to work now with "@types/react": "^16.0.5".
Most helpful comment
Thanks Andy,
It seems to work now with
"@types/react": "^16.0.5".