material-ui: Typescript broken in latest release `ElementType` requires between 0-1 type arguments
Steps to reproduce
yarn install && yarn tsc --skipLibCheck=false
Current behavior
node_modules/@mui/base/Unstable_Popup/Popup.d.ts:13:70 - error TS2707: Generic type 'ElementType' requires between 0 and 1 type arguments.
13 declare const Popup: React.ForwardRefExoticComponent<Omit<PopupProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<Element>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@mui/material/Popper/Popper.d.ts:46:17 - error TS2707: Generic type 'ElementType' requires between 0 and 1 type arguments.
46 component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@mui/material/Popper/Popper.d.ts:53:16 - error TS2707: Generic type 'ElementType' requires between 0 and 1 type arguments.
53 Root?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 3 errors in 2 files.
Errors Files
1 node_modules/@mui/base/Unstable_Popup/Popup.d.ts:13
2 node_modules/@mui/material/Popper/Popper.d.ts:46
Expected behavior
No typescript errors
Context
looks like this error started from the release yesterday.
Your environment
npx @mui/envinfo
System:
OS: macOS 14.2.1
Binaries:
Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
Yarn: 1.22.18 - /opt/homebrew/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.1/bin/npm
Browsers:
Chrome: 120.0.6099.129
Edge: 120.0.2210.91
Safari: 17.2.1
npmPackages:
@emotion/react: 11.11.3
@emotion/styled: 11.11.0
@mui/base: 5.0.0-beta.30
@mui/core-downloads-tracker: 5.15.3
@mui/material: 5.15.3
@mui/private-theming: 5.15.3
@mui/styled-engine: 5.15.3
@mui/system: 5.15.3
@mui/types: 7.2.12
@mui/utils: 5.15.3
@types/react: 17.0.74
react: 17.0.2
react-dom: 17.0.2
typescript: ~5.2.0 => 5.2.2
Search keywords: Typescript tsc GenericType
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Reactions: 17
- Comments: 29 (7 by maintainers)
Commits related to this issue
- Fix: Bumped packages using `npm run bump-all-packages` - Temporarily locked down "@mui/material": "5.15.2" and "@mui/base": "5.0.0-beta.28" due to https://github.com/mui/material-ui/issues/40427 — committed to heath-freenome/react-jsonschema-form by heath-freenome 7 months ago
- chore: Bumped packages using `npm run bump-all-packages` (#4006) * Fix: Bumped packages using `npm run bump-all-packages` - Temporarily locked down "@mui/material": "5.15.2" and "@mui/base": "5.0.... — committed to rjsf-team/react-jsonschema-form by heath-freenome 6 months ago
- use react 18 type definitions This seems to work around mui/material-ui#40427; `yarn tsc:full` no longer fails in a freshly-scaffolded test app. Signed-off-by: Jamie Klassen <jamie.klassen@broadcom.... — committed to jamieklassen/backstage by deleted user 6 months ago
I can confirm there’s still an issue with
Popper:I solved this issue by putting specific versions on our resolutions in
package.jsonfile.This issue happens to start at
https://www.npmjs.com/package/@types/react/v/18.2.44I wonder why our build process replaces the use of declared
PopperPropswith its value.See the implementation:
Here is the build result:
Update: Downgrading
@mui/x-data-gridto version6.19.1"helped resolved the types issue@raphaelbp12 “typescript”: “^5.3.3” “@mui/base”: “5.0.0-beta.30”, “@mui/lab”: “^5.0.0-alpha.159”, “@mui/material”: “^5.15.3”, “@mui/system”: “^5.15.3”, “@mui/x-data-grid”: “^6.18.6”, “@mui/x-date-pickers”: “^6.18.6”, “date-fns”: “^2.30.0”,
“@date-io/date-fns”: “^2.17.0”,
We’re seeing the same issue, and have pinned to @mui/material: “5.15.2” and “@mui/base”: “5.0.0-beta.28” as a workaround.
Order ID 72484
`npx @mui/envinfo`
``` System: OS: macOS 14.2.1 Binaries: Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node Yarn: 1.22.21 - ~/.nvm/versions/node/v18.15.0/bin/yarn npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm Browsers: Chrome: 120.0.6099.199 Edge: 120.0.2210.91 Safari: 17.2.1 npmPackages: @emotion/react: 11.11.1 @emotion/styled: 11.11.0 @mui/base: 5.0.0-beta.30 @mui/core-downloads-tracker: 5.15.3 @mui/lab: 5.0.0-alpha.159 @mui/material: 5.15.3 @mui/private-theming: 5.15.3 @mui/styled-engine: 5.15.3 @mui/system: 5.15.3 @mui/types: 7.2.12 @mui/utils: 5.15.3 @mui/x-charts: 6.18.3 @mui/x-data-grid: 6.18.6 @mui/x-data-grid-pro: 6.18.6 @mui/x-date-pickers: 6.18.6 @mui/x-date-pickers-pro: 6.18.6 @mui/x-license-pro: 6.10.2 @types/react: 18.2.42 => 18.2.42 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: 5.2.2 => 5.2.2 ```