vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.55k stars 373 forks source link

Vue3 vite element-plus项目,没有类型定义提示 #4471

Closed qq61966100 closed 1 week ago

qq61966100 commented 1 week ago

Vue - Official extension or vue-tsc version

Vue - Official

VSCode version

1.90.1

Vue version

3

TypeScript version

5.3.3

System Info

No response

Steps to reproduce

我导入了一个Vue3 vite element-plus项目,但是element-plus的组件在.vue文件中不提示类型定义,都是蓝色,别人用另外的工具导入同样的项目可以显示类型定义,这是怎么回事? image image

Link to minimal reproduction

No response

Any additional comments?

No response

qq61966100 commented 1 week ago

试过在"typeRoots": ["./node_modules/@types/", "./types"] 中加入 “。/node_modules”, tsconfig不报错了,但是.vue文件中还是不显示类型定义

so1ve commented 1 week ago

请提供最小重现。大概率是由于你没有生成自动导入dts。

RayGuo-ergou commented 1 week ago

If you are using pnpm, See https://github.com/vuejs/language-tools/issues/4401#issuecomment-2128053146

qq61966100 commented 1 week ago

请提供最小重现。大概率是由于你没有生成自动导入dts。

抱歉我的问题,使用了自动导入,但是auto-components.d.ts报错了,导致无法识别,不过我看这个项目的tsconfig中提示报错,说element-plus/global找不到,但是项目又能看正常的类型定义,不知道为啥?

qq61966100 commented 1 week ago

If you are using pnpm, See #4401 (comment)

Thanks, am using pnpm, but they are not same issue, i found the reason, but really appreciate for your response.

qq61966100 commented 1 week ago

My fault, thank you all, it caused by auto-components.d.ts. close it as no fixing is needed.