-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[@emotion/styled 10] TypeError using styled with @material-ui/core components after upgrade to v10 #1167
Labels
Comments
I've been having the same problem. This is the best workaround I've found thus far: const StyledTypography = styled(Typography)(({ theme }) => ({
backgroundColor: theme.palette.secondary.main,
})) as typeof Typography; |
@JakeGinnivan could you check if this works with your typings? I believe it should |
JakeGinnivan
pushed a commit
to JakeGinnivan/emotion
that referenced
this issue
Nov 5, 2019
JakeGinnivan
pushed a commit
to JakeGinnivan/emotion
that referenced
this issue
Nov 11, 2019
JakeGinnivan
pushed a commit
to JakeGinnivan/emotion
that referenced
this issue
Nov 11, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typescript
version: 3.2.2emotion
version: 10.0.6react
version: 16.7.0material-ui
version: 3.8.2Relevant code:
What you did: With Typescript and using @material-ui/core 3.7 or 3.8, try to upgrade from Emotion 9 to Emotion 10.
What happened: Using @material-ui/core with the upgraded Emotion 10 cause a TypeError when styling any material-ui component with styled function.
Error log:
Reproduction: A GitHub repository is provided next with an example (based on a simple material-ui component, Typography. Also, there is a CodeSandbox with the same code, but it hides the problem and works.
Problem description: When using
styled
from@emotion/styled
with any component from@material-ui/core
, the second part of the args contains a type error, so there is no way to use. Styling HTML components works well (div
,span
, etc) or any component created by user works like a charm. Also, this happens with template literal syntax.Suggested solution: Currently, I tried to type
styled(Typography)<any>({})
but with this solution we will lose the types in the style object, so this isn't a solution at all, only the worst bypass I should never thought.The text was updated successfully, but these errors were encountered: