JSX element type 'Wrapper' does not have any construct or call signatures.
See original GitHub issueEnvironment
- “typescript”: “^4.5.2”
- “@linaria/babel-preset”: “^3.0.0-beta.14”,
- “@linaria/core”: “^3.0.0-beta.13”,
- “@linaria/react”: “^3.0.0-beta.14”,
- “@linaria/shaker”: “^3.0.0-beta.14”,
- “react”: “^17.0.2”,
- “react-dom”: “^17.0.2”,
- node -v v14.18.1
Description
Hi, I have a problem with a typecheck of components. When I create styled component from a html element and use it I get ts error: “TS2604: JSX element type ‘Wrapper’ does not have any construct or call signatures.”
Workaround is to set types manually: styled.div<React.FunctionComponent<React.HTMLAttributes<HTMLDivElement>>>
Reproducible Demo
Doesn’t work
import { styled } from '@linaria/react';
const Wrapper = styled.div`
padding: 10px;
`;
const CancelPage = () => {
return <Wrapper>x</Wrapper>;
};
export default CancelPage;

Works:
import { styled } from '@linaria/react';
import * as React from 'react';
const Wrapper = styled.div<React.FunctionComponent<React.HTMLAttributes<HTMLDivElement>>>`
padding: 10px;
`;
const CancelPage = () => {
return <Wrapper>x</Wrapper>;
};
export default CancelPage;
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
JSX element type Elem does not have any construct or call ...
Simply speaking, the type React.Component<any, any> used is the wrong type which remains unresolved. I used React.FunctionComponent and it worked for me.
Read more >JSX element type does not have any construct or call signatures
The error "JSX element type does not have any construct or call signatures" occurs when we try to pass an element or a...
Read more >JSX element type does not have any construct or call ... - GitHub
Hm, so the issue is that ReactType<any> returns a union of every builtin jsx tag (plus ComponentType<any> , but that part's not problematic), ......
Read more >jsx element type does not have any construct or call ... - You.com
JSX element type 'Student' does not have any construct or call signatures. You get this kind of error because you tried to pass...
Read more >“JSX element type 'Hello' does not have any construct or call ...
Answers related to “JSX element type 'Hello' does not have any construct or call signatures”. Element implicitly has an 'any' type because expression...
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 Free
Top 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

Adding
esModuleInteropoption totsconfig.jsonhas fixed the issue for me, dunno why ¯\_(ツ)_/¯With a newer versions I don’t have a problem anymore.