-
-
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
Using @emotion/core <Global /> with TypeScript throws an error #971
Comments
Okay, it is something with my config... set up CodeSandbox, worked there. Created a new react-app with TS, and it also worked there.
Maybe pointers? |
Thank you for posting this issue! |
Just did |
@joltmode Do you have any old packages like emotion@9 in your dependencies? If that's the case, that can make the issue. |
Yup, that was it. Was in middle of migration from v9 to v10.. But I did try an example where I installed v9 alongside, it still worked. So it appears one can have packages, it's when they are imported, that the conflict arises. |
Yes, problematic type will be imported only when you import one. |
For future readers, I had a similar problem with types in my Chakra UI app. @tomsseisums comment leads me to a solution. My emotions modules were not at the same version. I used now "@emotion/core, @emotion/react and @emotion/styled. They were not in sync since emotion/core was used before in my project and was in v10 while emotion/react and emotion/styled was in v11. With using v11 for emotion/core or like I do, remove it completely and used emotion/react, makes it works now. Hope this will be useful! |
* chore: init storybook * chore(storybook): configure storybook Ref: - storybookjs/storybook#13486 (comment) - emotion-js/emotion#971 * chore: update packages * chore: add ts config for sb, use webpack5 - https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration - https://storybook.js.org/blog/storybook-for-webpack-5/ - https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#upgrade - storybookjs/storybook#15336 (comment) * chore: add shared components stories
@pom421 I still have this problem when using Chakra UI in my react app. all of them is v11. |
@rezamajidi Make sure you only have one version of |
Hey @rezamajidi, you should always be using the same version of |
@rezamajidi That seems like a different issue than what this thread is about. What makes you think it is an Emotion issue? It seems more likely that it is caused by Chakra UI. Please create a new Emotion issue if you still get this error without Chakra UI. |
emotion
version: 10.0.0-beta.5react
version: 16.6.0Relevant code:
What you did:
Attempted to add
<Global />
styles with TypeScript.What happened:
Reproduction:
Add
<Global />
toApp.tsx
and it should be there! I haven't tested in exactly that way, but I haven't changed anything of significance in tsconfig.json.Problem description:
Doesn't work neither with object syntax, nor with
css
template literal.Suggested solution:
n/a
The text was updated successfully, but these errors were encountered: