question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSX element type 'Wrapper' does not have any construct or call signatures.

See original GitHub issue

Environment

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;

image

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:11

github_iconTop GitHub Comments

2reactions
victordidenkocommented, Feb 1, 2022

Adding esModuleInterop option to tsconfig.json has fixed the issue for me, dunno why ¯\_(ツ)_/¯

{
  "compilerOptions": {
+    "esModuleInterop": true,
0reactions
fabulatorcommented, Oct 30, 2022

With a newer versions I don’t have a problem anymore.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found