Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styled.div returns type any and throws error #40139

Closed
2 tasks done
delijah opened this issue Dec 8, 2023 · 2 comments
Closed
2 tasks done

styled.div returns type any and throws error #40139

delijah opened this issue Dec 8, 2023 · 2 comments
Labels
package: system Specific to @mui/system

Comments

@delijah
Copy link

delijah commented Dec 8, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/p/devbox/mui-styled-div-tz7n45?file=%2Fsrc%2FApp.tsx

Steps:

  1. Open the codesandbox link
  2. You'll see that the app does not work, an error is thrown

Current behavior 😯

Throws error: Uncaught TypeError: _mui_material__WEBPACK_IMPORTED_MODULE_2__.default.div is not a function

Also the type any is returned.

When using styled('div') instead of styled.div, there is no problem.

Expected behavior 🤔

No error should be thrown. Both styled('div') and styled.div must work and a reasonable type must be returned.

Context 🔦

We try to use MUI with theme scoping with styled-components v6.

Your environment 🌎

npx @mui/envinfo
  Used Browser: Chrome

  System:
    OS: macOS 12.6.1
  Binaries:
    Node: 16.20.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 119.0.6045.199
    Edge: Not Found
    Safari: 15.6.1
  npmPackages:
    @mui/base:  5.0.0-beta.25
    @mui/core-downloads-tracker:  5.14.19
    @mui/material: 5.14.19 => 5.14.19
    @mui/private-theming:  5.14.19
    @mui/styled-engine:  5.14.19
    @mui/styled-engine-sc: 6.0.0-alpha.7 => 6.0.0-alpha.7
    @mui/system:  5.14.19
    @mui/types:  7.2.10
    @mui/utils:  5.14.19
    @types/react: 17.0.70 => 17.0.70
    react: 17.0.2 => 17.0.2
    react-dom: 17.0.2 => 17.0.2
    styled-components: 6.1.0 => 6.1.0
    typescript: 4.8.4 => 4.8.4

Support Key

#80425

@delijah delijah added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 8, 2023
@delijah delijah changed the title styled.div does throw error styled.div returns type any and throws error Dec 8, 2023
@zannager zannager added the package: system Specific to @mui/system label Dec 8, 2023
@delijah
Copy link
Author

delijah commented Dec 12, 2023

@zannager @brijeshb42 Added our support key to the issue description.

@ZeeshanTamboli
Copy link
Member

styled.div isn't supported in @mui/material.

Duplicate of #29723, #28574.

@ZeeshanTamboli ZeeshanTamboli closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@ZeeshanTamboli ZeeshanTamboli removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: system Specific to @mui/system
Projects
None yet
Development

No branches or pull requests

4 participants