Skip to content

Using a const as intermediate to export default causes Volar to color subcomponents red #736

@SimmeNilsson

Description

@SimmeNilsson

Code below works well, SubComponent is colored green in the html template:

<template>
    <h1>{{ title }}</h1>
    <SubComponent></SubComponent>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import SubComponent from "./SubComponent.vue";

export default defineComponent({
    components: {
        SubComponent
    },
    setup() {
        return {
            title: "Works well"
        };
    }
});
...

However, if I store the result of defineComponent in a const and then export it, SubComponent is now colored red in template.
Template and imports same in both cases.

const component  = defineComponent({
    components: {
        SubComponent
    },
    setup() {
        return {
            title: "Confuses Volar"
        };
    }
});

export default component;
...

I need the output from defineComponent for an inhouse framework purpose.
How can I avoid confusing Volar? Or should it get confused by this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions