Closed Leningrade closed 1 year ago
Same issue. I have installed "@types/react": "^18.0.28"
and "@mui/material": "^5.12.2"
and got the same error.
Same issue: it seems that prop-types package is using an old version of react-is
:
└─┬ @mui/material@5.12.2
├─┬ @mui/base@5.0.0-alpha.127
│ └── react-is@18.2.0 deduped
├─┬ @mui/utils@5.12.0
│ └── react-is@18.2.0 deduped
├─┬ prop-types@15.8.1
│ └── react-is@16.13.1
└── react-is@18.2.0
saw something maybe sort of related, with https://github.com/mui/material-ui/blob/master/packages/mui-utils/package.json installing @types/react-is? it is getting v17 when i'm trying to use v18 (i am getting a bunch of errors, and using skipLibCheck makes em go away, but was interested in trying to not skipLibCheck)
While this issue is not merged, we can force the dependency resolution in our package.json
.
This works with Yarn, I believe NPM uses overrides
instead of resolutions
.
{
...
"dependencies": {
...
}
"resolutions": {
"@types/react-is": "18.2.0"
}
}
Duplicates
Latest version
Steps to reproduce 🕹
Steps:
npm typeckeck
which runstsc --no-emit
This should result in an error report ending in:
Example errors include:
Current behavior 😯
The TSC process ends with multiple errors (displayed above), all in the type definition files for react. Some of those where installed as dependencies for @mui/material.
Expected behavior 🤔
runing
npm typecheck
or similar should not throw any errosContext 🔦
After updating my projects typescript version, attempting to run a typecheck results in multiple errors on the @types/react-is and @types/react modules.
My current hypothesis is that this is a problem caused by the dependencies for @mui/material:
@mui/utils@5.12.0`` is installs ``@types/react-is@17.0.4
, which in turn installs@types/react@17.0.58
. this is possibly causing conflicts with the root installation of@types/react@18.2.0
$ npm ls @types/react
Your environment 🌎
``` System: OS: Linux 6.2 Nobara Linux 37 (Thirty Seven) Binaries: Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node Yarn: Not Found npm: 9.6.5 - ~/Documents/project/node_modules/.bin/npm Browsers: Firefox: 112.0 npmPackages: @emotion/react: ^11.10.6 => 11.10.6 @emotion/styled: ^11.10.6 => 11.10.6 @mui/base: 5.0.0-alpha.127 @mui/core-downloads-tracker: 5.12.2 @mui/icons-material: ^5.8.4 => 5.11.16 @mui/material: ^5.12.2 => 5.12.2 @mui/private-theming: 5.12.0 @mui/styled-engine: 5.12.0 @mui/system: 5.12.1 @mui/types: 7.2.4 @mui/utils: 5.12.0 @mui/x-date-pickers: ^6.2.1 => 6.2.1 @types/react: ^18.2.0 => 18.2.0 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.0.4 => 5.0.4 ```npx @mui/envinfo
Ts & Vite config
Tsconfig ``` { "compilerOptions": { "target": "ESNext", "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], "allowJs": true, "skipLibCheck": false, "esModuleInterop": false, "allowSyntheticDefaultImports": true, "strict": false, "forceConsistentCasingInFileNames": true, "module": "ESNext", "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx" }, "include": ["./src", "vite.config.ts"] } ``` vite.config.js ``` import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import eslintPlugin from 'vite-plugin-eslint'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ eslintPlugin({ cache: false}), react()], }) ```