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 does not have any construct or call signatures.ts(2604)

See original GitHub issue

This happens when using vue-class-component. Here is an example snippet. (Taken from https://class-component.vuejs.org/guide/class-component.html#other-options and converted to TS)

<template>
  <OtherComponent />
</template>

<script lang="ts">
import Vue from 'vue'
import Component from 'vue-class-component'
import OtherComponent from './OtherComponent.vue'

@Component({
  components: {
    OtherComponent
  }
})
export default class HelloWorld extends Vue {}
</script>

This happens because https://github.com/johnsoncodehk/volar/tree/master/packages/vue-language-service does not support vue-class-component syntax, so volar can’t understand where the component definition is coming from.

I believe vue-class-component is still officially supported by Vue team, so we should have support for it in Volar as well.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:23
  • Comments:46 (13 by maintainers)

github_iconTop GitHub Comments

15reactions
noah-ossocommented, Jun 6, 2022

Reverting to version 0.36.1 looks safe.

image

14reactions
johnsoncodehkcommented, Jun 7, 2022

I’m getting this with vue-router, in particular. 0.36 is fine. 0.37 does JSX element type 'RouterView' does not have any construct or call signatures. and JSX element type 'RouterLink' does not have any construct or call signatures..

@zlotnika You can define global component type by GlobalComponents interface for vue-router and project components, see https://github.com/johnsoncodehk/volar/tree/master/extensions/vscode-vue-language-features#usage.

Or in v0.37.1, you can config experimentalSuppressUnknownJsxPropertyErrorsexperimentalSuppressInvalidJsxElementTypeErrors = true to ignore unknown component type errors.

// tsconfig.json
{
  "vueCompilerOptions": {
    "experimentalSuppressInvalidJsxElementTypeErrors": true
  }
}
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
Actual behavior: TS2604: JSX element type 'Comp' does not have any construct or call signatures.
Read more >
jsx element type 'component' does not have any construct or ...
JSX element type 'Component' does not have any construct or call signatures. [2604] That's because, in the RouteProps interface, the component is defined...
Read more >
JSX element type X does not have any construct or call ...
Type the styled component as React.Component to solve this error in Material UI with React and TypeScript.
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