Skip to content

Autocompleting typescript types adds an inline dynamic import instead of a static import at the top of the file #6069

Description

@Spore-Void

Vue - Official extension or vue-tsc version

vue-tsc 3.3.2

VSCode version

VSCodium 1.107.18627

Vue version

3.5.34

TypeScript version

6.0.3

System Info

System:
  OS: Windows 10 10.0.19045
  CPU: (16) x64 Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
  Memory: 30.72 GB / 63.89 GB
Binaries:
  Node: 22.21.1 - C:\nvm4w\nodejs\node.EXE
  Yarn: 1.22.11 - C:\Users\<User>\AppData\Roaming\npm\yarn.CMD
  npm: 10.9.4 - C:\nvm4w\nodejs\npm.CMD
  pnpm: 10.33.4 - C:\Users\<User>\AppData\Local\Microsoft\WinGet\Packages\pnpm.pnpm_Microsoft.Winget.Source_8wekyb3d8bbwe\pnpm.EXE
Browsers:
  Chrome: 147.0.7727.102
  Edge: Chromium (140.0.3485.54)
  Firefox: 151.0 - C:\Program Files\Mozilla Firefox\firefox.exe

package.json dependencies

{
  "dependencies": {
    "vue": "^3.5.32"
  },
  "devDependencies": {
    "@tsconfig/node24": "^24.0.4",
    "@types/node": "^24.12.2",
    "@vitejs/plugin-vue": "^6.0.6",
    "@vue/tsconfig": "^0.9.1",
    "npm-run-all2": "^8.0.4",
    "typescript": "~6.0.0",
    "vite": "^8.0.8",
    "vite-plugin-vue-devtools": "^8.1.1",
    "vue-tsc": "^3.3.2"
  }
}

Steps to reproduce

  1. Create a vue app using npm create vue@latest (Typescript enabled)
  2. Attempt to autocomplete any type to add its import.

Example:

<script setup lang="ts">
const test: Component; // <- autocomplete and add the import via intellisense
</script>

What is expected?

A static import at the top of the file should be generated.

<script setup lang="ts">
import type { Component } from 'vue';

const test: Component;
</script>

What is actually happening?

Intellisense autocompletes as an inline dynamic import instead:

<script setup lang="ts">
const test: import('vue').Component;
</script>

Link to minimal reproduction

No response

Any additional comments?

The unexpected behavior does not occur when downgrading the Vue VSCode extension to 3.3.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first🔨 p3-minor-bug

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions