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

Using Box from MUI cause error #823

Closed
dspaethe opened this issue Mar 22, 2022 · 9 comments
Closed

Using Box from MUI cause error #823

dspaethe opened this issue Mar 22, 2022 · 9 comments

Comments

@dspaethe
Copy link

dspaethe commented Mar 22, 2022

After adding the component "drei" to my existing project, every occurrence of Box from Material UI (mui.com) produce this error:
Expression produces a union type that is too complex to represent. TS2590

Adding this completely redundant property to every single Box in the whole project solve it somehow:
component='div'
https://stackoverflow.com/questions/68692230
But this workaround is very ugly.

Similar issue reported here:
#704 (comment)_

@dspaethe dspaethe changed the title This sis till occurring with the Box component from MUI. Using Box from MUI cause error Mar 22, 2022
@mracette
Copy link

Same thing here. This is not great for MUI users.

@gsimone
Copy link
Member

gsimone commented Apr 22, 2022

Do you have an idea of what's causing this problem? From the stack overflow it looks like removing some random d files "solves it", but it's not clear to me why those specific files would be a problem.

I don't get why ts would fail to correctly guess the type of Box since both would be imported and not parts of global namespace overrides 🤔

@joshuaellis @CodyJasonBennett ideas?

@CodyJasonBennett
Copy link
Member

This pretty clearly sounds like a larger issue with TypeScript although I'd be interested in potential workarounds regarding the Box component.

@mracette
Copy link

Some insight into why TS produces this error can be found here: microsoft/TypeScript#33130

@reggie3
Copy link

reggie3 commented May 7, 2022

I've seen this issue in projects that don't use drei. I was able to solve it by specifying the component prop of MUI Box components as div like this

<Box component="div" ... \>

@Methuselah96
Copy link
Contributor

Just for cross-referencing, I filed mui/material-ui#34068 in the MUI repo with more of an explanation of what's going on.

@zigang93
Copy link

zigang93 commented Sep 25, 2023

I am using @react-three/drei, @react-three/fiber and mui packages..
It seem like each packages have their Box element.. it cause conflict on each other..

References:
mui/material-ui#34068
pmndrs/react-three-fiber#1752 (reply in thread)

@CodyJasonBennett
Copy link
Member

This was fixed in R3F v8.17.8.

@Methuselah96
Copy link
Contributor

I could be wrong, but I think this issue was slightly different, and was fixed on the MUI side by mui/material-ui#43384

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants