Type Error with TypeScript 3.8.2 and theme 🏷
See original GitHub issueCurrent behavior:
After updating typescript to 3.8.2 I’ve got an error with the theme.
If a styled component uses the theme
from the props the typescripts throw an error where I import and use the styled-component.
The error tells that I don’t pass the theme
in the styled-component.
Error: 'theme' is declared here.
To reproduce:
- Update TS to 3.8.2
- Create a styled-component and use the
theme
from props - Implement the styled-component
- Check the type error
Expected behavior:
The styled-component shouldn’t expect the theme
where we plan to use it.
If I make the theme
here an optional parameter here the error dissolves but It creates another error because theme
becomes an optional parameter.
I think the theme
should be omitted in this file, maybe that would solve the issue.
Environment information:
react
version: 16.9.0emotion
version: 10.0.27typescript
version: 3.8.2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Announcing TypeScript 3.8 - Microsoft Developer Blogs
This type-checking can tell us about errors like typos and values that are potentially null and undefined before we even run our code....
Read more >Documentation - TypeScript 3.8
TypeScript 3.8 adds a new syntax for type-only imports and exports. ... error! A type-only import can specify a default import or named...
Read more >React typescript '=' expected. TS1005 - Stack Overflow
Apologies, I misread it as an attempt to import a variable named type from ./types. What does your tsconfig look like? – Connor...
Read more >TypeScript Compiling with Visual Studio Code
log ) in our TypeScript file, we may get the following output from tsc : HelloWorld.ts(3,17): error TS2339: Property 'logg' does not exist...
Read more >TypeScript | WebStorm Documentation - JetBrains
icon. TypeScript-aware coding assistance includes completion for keywords, labels, variables, parameters, and functions, error and syntax ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PR with fix here: https://github.com/emotion-js/emotion/pull/1788
If you’re a
patch-package
user:patches/@emotion+styled-base+10.0.28.patch
Thank you @Js-Brecht for the repro - I was able to test bunch of stuff using it. And thank you @aaronjensen for the fix.
I should release the fix by the end of the weekend.