Skip to content

Vue element cannot be used as a JSX component #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
flashspys opened this issue Oct 29, 2021 · 1 comment
Closed

Vue element cannot be used as a JSX component #646

flashspys opened this issue Oct 29, 2021 · 1 comment

Comments

@flashspys
Copy link

This error looks like a duplicate of #553 but still happens in version v0.28.10. We have the following minimal file example

<template>
    <Event />
</template>

<script lang="ts">
import { defineComponent } from "@vue/composition-api";
import Event from "../event/Event.vue";

export default defineComponent({
  components: {
    Event,
  },
});
</script>

The <Event /> tag in the template row is red underlined with the following error:

'__VLS_9' cannot be used as a JSX component.
  Its instance type 
  'object & Record<never, any> & Vue & { $data: Data; $props: Readonly<Partial<{}> & Omit<{ event: EventListEventFieldsFragment; } & {}, never>>; $attrs: Data; } & ... 4 more ... & Omit<...>'
  is not a valid JSX element.
ts(2786)

We are using Volar with take-over-mode enabled and Typescript 4.4.2. Is this error message due to a bug in Volar or a configuration mistake from our side?

@johnsoncodehk
Copy link
Member

Hi @flashspys, please provide a repro case so I can check the problem.

And also make sure you have correct setup for vue 2, see https://github.com/johnsoncodehk/volar/tree/master/extensions/vscode-vue-language-features#using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants