Props don't work anymore with TypeScript 3.4.1
See original GitHub issueemotion
version: 10.0.10react
version: 16.8.6
Relevant code:
const Container = styled.div((props: { test: number }) => ({
width: props.test,
}));
What you did:
Updated TypeScript to the latest version 3.4.1
What happened:
error TS2345: Argument of type '(props: { test: number; }) => { width: number; }' is not assignable to parameter of type 'TemplateStringsArray'.
Type '(props: { test: number; }) => { width: number; }' is missing the following properties from type 'TemplateStringsArray': raw, concat, join, slice, and 16 more.
Reproduction:
Just create a fresh empty project with TypeScript and emotion and paste my code above into it. I can do that for you if you want, but it’s so simple to reproduce that I thought it is not necessary.
Problem description:
Does not compile anymore. With the TypeScript version before (3.3.4000
) it worked.
Suggested solution:
Fix TypeScript definition.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:16
- Comments:9 (6 by maintainers)
Top Results From Across the Web
The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 ...
In my case, I had to use npm install typescript@">=3.4. 0 and <3.6. 0" --save-dev because the warning was showing the version interval...
Read more >Documentation - TypeScript 3.4
TypeScript 3.4 can now produce generic function types when inference from other generic functions produces free type variables for inferences. This means many ......
Read more >What's New in Typescript 3.4 - Medium
TypeScript is a programming language which builds on Javascript and provides optional static types. If you are not familiar with it please ...
Read more >Announcing TypeScript 3.5 - Microsoft Developer Blogs
Today we're happy to announce the availability of TypeScript 3.5! If you're new to TypeScript, it's a language that builds on JavaScript ...
Read more >Component prop types are not inferred when using styled ...
Currently WebStorm's own support for TypeScript doesn't see these props, but when the TypeScript service is enabled in the IDE (and it's on...
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
And with the other syntax
styled('div')
, you can do:Solution:
✌️