Skip to content

Imported types not found when using <script setup> with defineModel and JSDoc import Tag #5272

@twisterniq

Description

@twisterniq

Vue - Official extension or vue-tsc version

3.0.0-alpha.0

VSCode version

1.98.1

Vue version

3.5.13

TypeScript version

5.8.2

System Info

package.json dependencies

{
  "dependencies": {
    "vue": "^3.5.13"
  }
}

Steps to reproduce

  1. Copy and paste into a new .vue file:
<template>
  <div>{{ test }}</div>
</template>

<script setup>
// @ts-check
import { ref } from 'vue';

/** @import { Ref } from 'vue' */

const modelValue = defineModel({
  type: Boolean,
  default: false,
});

/** @type {Ref<string | null>} */
const test = ref('123');
</script>
  1. Should see that there is an error on line 16:

Image

  1. If you move the /** @import { Ref } from 'vue' */ after defineModel statement, then it works correctly:

Image

What is expected?

Ref type or any type imported just before defineModel should be recognized correctly.

What is actually happening?

Ref type or any type imported just before defineModel is not being recognized.

Link to minimal reproduction

No response

Any additional comments?

I'm not able to reproduce it in the Vue SFC Playground.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first🔩 p2-edge-case

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions