Skip to content

[Vue 2.7] Type of annotated prop not recognized in the component #2347

Closed
@rchl

Description

@rchl

Repro:

Repository: https://github.com/rchl/volar-vue2-test (pages/typeless.vue file)

<template>
    <div>noop</div>
</template>

<script>
export default {
    props: {
        tracks: {
            /** @type {import('vue').PropType<MyNamespace.Track[]>} */
            type: Array,
            required: true,
        },
    },
    data() {
        return {
            inputs: this.tracks.map(track => track),
        };
    },
};
</script>
declare namespace MyNamespace {
    type Track = {
        id: number;
        title: string;
    };
}

Expected

The type of this.tracks is correctly reported as Track[]

Actual

Screenshot 2023-01-30 at 23 10 41

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions