Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are no IntelliSense for Components props in VSCode #6013

Closed
kingshuaishuai opened this issue Jul 5, 2024 · 9 comments
Closed

There are no IntelliSense for Components props in VSCode #6013

kingshuaishuai opened this issue Jul 5, 2024 · 9 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@kingshuaishuai
Copy link

kingshuaishuai commented Jul 5, 2024

Describe the bug

Problems

When the mouse points to the component, the component type is indicated.

image

But, There's no intellisense when I type in props.

image

My Custom Components is normal. And It's type is Wrapped By __VLS_WithDefaults<__VLS_TypePropsToOption<>>, I can get intellisense for it.
image
image

Reproducer

https://stackblitz.com/edit/primevue-4-ts-vite-issue-template-s6kabt?file=src%2FApp.vue

PrimeVue version

4.0

Vue version

^3.4.21

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@kingshuaishuai kingshuaishuai added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 5, 2024
@kingshuaishuai
Copy link
Author

Maybe DefineComponent type in @primevue/core is incorrect, I change DefineComponent's import from 'vue' in primevue/button, it works!

image image

@kingshuaishuai
Copy link
Author

I try to use extends to create new DefineComponent interface, it not woks. Maybe the type only can be written by vue's export .

@kingshuaishuai
Copy link
Author

Maybe it is monorepo dependencies issue. before i installed vue in root project as dependencies and every child project as dev and peer dependency, then I delete all vue dependencies in child project, and just installed it on root project, the component prop intellisense is work!

@2234839
Copy link
Contributor

2234839 commented Jul 17, 2024

My project also has this problem, vscode has no relevant type hints at all
图片

@kingshuaishuai
Copy link
Author

My project also has this problem, vscode has no relevant type hints at all 图片

我解决的步骤是 重新创建一个新项目,然后开启自动导入,发现新项目是 OK 的,然后在老项目中找是不是哪里出问题了,如果用的 vite,在 vite 中配置自动导入后,记得在 tsconfig 中引入 components.d.ts
image
image
如果你用的是 nuxt,nuxt 中它的模块中关闭了 dts 文件的生成,你可以直接修改 �node_modules 中的文件,开启 dts,然后使用 patch-package 创建一个补丁,之后在nuxt.config.ts中将对应的文件包含进来
image
希望对遇到此问题的人有所帮助

English Version:
My solution is to create a new project, and then turn on the automatic import, found that the new project is OK, and then find out if there is something wrong in the old project, if you use vite, after configuring the automatic import in vite, remember to introduce components.d.ts in tsconfig:
image
image

If you use nuxt, nuxt has modules that disable dts generation, you can switch to �node_modules to enable dts. Then use [patch - package] (https://www.npmjs.com/package/patch-package) to create a patch, after nuxt. Config. Ts include the corresponding files:
image

I hope this will be helpful to those who encounter this problem

@2234839
Copy link
Contributor

2234839 commented Jul 17, 2024

@kingshuaishuai 非常感谢你的帮助,但我这里新建一个项目,然后引入 primeVue 都无法获得正确的类型提示
图片

@kingshuaishuai
Copy link
Author

kingshuaishuai commented Jul 17, 2024

@kingshuaishuai 非常感谢你的帮助,但我这里新建一个项目,然后引入 primeVue 都无法获得正确的类型提示 图片

能出现这些就是有智能提示的
image
:value 我的情况跟你一样,具体的值你可以点进组件内部查看具体类型,然后自己加就行:
image
image

@2234839
Copy link
Contributor

2234839 commented Jul 17, 2024 via email

@2234839
Copy link
Contributor

2234839 commented Jul 21, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants