mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.31k stars 32.12k forks source link

5.16.6 Bug - Cannot be named without a reference to '@mui/material/node_modules/@mui/system'. This is likely not portable. A type annotation is necessary. #43136

Open ozanmanav opened 1 month ago

ozanmanav commented 1 month ago

Steps to reproduce

Link to live example: (required)

Steps:

  1. Upgrade library to 5.16.6
  2. Build project with turborepo monorepo

Current behavior

The inferred type of 'StyledFooterLogo' cannot be named without a reference to '@mui/material/node_modules │ /@mui/system'. This is likely not portable. A type annotation is necessary.

image

Expected behavior

It should be give any error, build should be success.

Context

No response

Your environment

npx @mui/envinfo ``` System: OS: macOS 14.5 Binaries: Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node npm: 10.2.5 - ~/.nvm/versions/node/v18.18.2/bin/npm pnpm: Not Found Browsers: Chrome: 127.0.6533.74 Edge: Not Found Safari: 17.5 npmPackages: @emotion/react: ^11.13.0 => 11.13.0 @emotion/styled: ^11.13.0 => 11.13.0 @mui/base: 5.0.0-beta.40 @mui/core-downloads-tracker: 5.16.6 @mui/icons-material: ^5.16.5 => 5.16.5 @mui/material: ^5.16.6 => 5.16.6 @mui/private-theming: 5.16.5 @mui/styled-engine: 5.16.4 @mui/system: 5.16.5 @mui/types: 7.2.15 @mui/utils: 5.16.5 @mui/x-charts: 7.9.0 @mui/x-data-grid: 7.11.1 @mui/x-data-grid-premium: ^7.11.1 => 7.11.1 @mui/x-data-grid-pro: 7.11.1 @mui/x-date-pickers: 7.11.1 @mui/x-date-pickers-pro: ^7.11.1 => 7.11.1 @mui/x-internals: 7.11.1 @mui/x-license: ^7.11.1 => 7.11.1 @types/react: ^18.3.3 => 18.3.3 react: ^18.3.1 => 18.3.1 react-dom: ^18.3.1 => 18.3.1 typescript: 5.5.4 => 5.5.4 ```

Search keywords: 5.16.6, bug, @mui/material/node_modules/@mui/system

mnajdova commented 1 month ago

It doesn't look like this bug report has enough info for one of us to reproduce it. Please provide a CodeSandbox (https://material-ui.com/r/issue-template-latest), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

ozanmanav commented 1 month ago

It doesn't look like this bug report has enough info for one of us to reproduce it. Please provide a CodeSandbox (https://material-ui.com/r/issue-template-latest), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

Creating a case is a bit difficult for my situation, we are using turbo repo and we have ui package as a package and we compile it with tsup, we get this error while compiling and a warning like the one below appears, this warning is not present in 5.16.5, it is present in 5.16.6.

image

tsup.config.ts

image

tsconfig.prod.json

image

tsconfig.base.json

image
ozanmanav commented 1 month ago

@brijeshb42 @mnajdova Interestingly, adding the @mui/system package solved the problem, but I don't think this is an ideal solution.

image
Kizmar commented 3 weeks ago

Seeing the same thing in both 5.16.6 and 5.16.7. All of the styled components start throwing this TS error when I upgrade to these versions.

image

I thought maybe it installed multiple versions when I did the "yarn upgrade ...", but after deleting "node_modules" and "yarn.lock" and re-installing, I'm getting the same thing. I haven't tried adding "@mui/system" yet. I reverted back to 5.16.5 where this is all still working.

ozanmanav commented 3 weeks ago

Seeing the same thing in both 5.16.6 and 5.16.7. All of the styled components start throwing this TS error when I upgrade to these versions.

image

I thought maybe it installed multiple versions when I did the "yarn upgrade ...", but after deleting "node_modules" and "yarn.lock" and re-installing, I'm getting the same thing. I haven't tried adding "@mui/system" yet. I reverted back to 5.16.5 where this is all still working.

Likewise, I went back to the version because adding the MUI system does not make much sense. I will look again for a solution as soon as possible and we expect support from the MUI team, we are blocked in the version. @mnajdova @brijeshb42

yusuferenayas commented 3 weeks ago

Getting same error in my project too.