Replies: 2 comments 6 replies
-
If you are providing your theme using |
Beta Was this translation helpful? Give feedback.
-
any ideas what could cause the I thought it could be the
and
I have been trying to reproduce in a codesandbox, but with a full production/private company app, it's hard to replicate all conditions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We are converting our codebase to TypeScript. Therefore our style files which reference
props.theme.color.black
has compiler issues because ourtheme.color.red
is not defined. I decided to upgrade to v11 from 10 following the guide in Emotion.Original Files:
Above is converted to
theme.ts
andexport const theme: Theme = {
is the only change in this file.providers.js wraps our app:
Updated Files:
props.theme.colors.black
hastheme
as an empty object stilltheme
fromuseTheme
fail.After trying to debug this 2 thing stands out:
<ThemeProvider />
was from 'emotion-theming'. The codeMod changed it to@emotion/react
useTheme
references was from 'emotion-theming'. The codeMod changed it to@emotion/react
I tried overriding the codemod to put back use of
emotion-theming
and all is good now:props.theme
is no longer empty anduseTheme
's theme is no longer empty.Questions: Why are the codemods from
emotion-theming
->@emotion/react
breaking my theme references? The update from V10 > V11 with Typescript should be pretty straightforward swap, yes?Beta Was this translation helpful? Give feedback.
All reactions