-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Current behavior:
I believe I've followed the docs in how to get theming to work with TypeScript, but it doesn't seem to work.
I've added both @emotion/react and @emotion/styled, defined what Theme should be in a types.d.ts file, and VsCode/Webstorm still do not recognize the return value of useTheme() or the theme in styled('div') $(props => props.theme...).... ;` as the theme I provided.
To reproduce:
- Clone this example project I've created just for this ticket: https://github.com/amcsi/emotion-typescript-reproduction
- Run
npm install - Check the
useTheme()andstyled('div')uses inApp.tsxand see that the type of the theme is not recognized to be the same as what I defined in types.d.ts
Expected behavior:
Theme should be recognized as {hey: string}
Video demo:
2025-11-11.17-45-06.mp4
Environment information:
reactversion: 19.2.0 (but this happens in React 18 as well)@emotion/reactversion: 11.14.0@emotion/styledversion: 11.14.1 (but this happens with version 11.14.0 too)
Reactions are currently unavailable