You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using unplugin-vue-components to auto-import components, we noticed that the generated components.d.ts only declares global components for the vue module, for example:
Yes, I have already done so, but it only recognizes file extensions in the dirs directory, and the resulting components can only be used in the vue module, which makes it impossible to directly use these components in the tsx file
Activity
userquin commentedon Apr 15, 2025
shouldn't be
<TForm>instead<Form>atox996 commentedon Apr 16, 2025
This is just a description error, but the actual result is still an error due to the reason of
declare module 'vue'userquin commentedon Apr 16, 2025
Can you try adding vite-vue-jsx and the tsx extension in the vite vue components config?
https://github.com/unplugin/unplugin-vue-components/blob/main/src/types.ts#L89
atox996 commentedon Apr 17, 2025
Yes, I have already done so, but it only recognizes file extensions in the dirs directory, and the resulting components can only be used in the vue module, which makes it impossible to directly use these components in the tsx file
l246804 commentedon Oct 24, 2025
+1
yanhao98 commentedon Oct 24, 2025
我目前使用
naive-ui的解决方法,使用unplugin-auto-import/vite查看代码/View code
这将在
auto-imports.d.ts生成全局类型MaLuns commentedon Oct 31, 2025
Refer to #669. You can write a vite plugin to handle it
use
result
l246804 commentedon Oct 31, 2025
The current issue is that auto-import isn’t working in tsx files, and it’s not just a problem of missing dts type declarations.
MaLuns commentedon Oct 31, 2025
Well, you're right. It works in
<script setup lang="tsx">, but it won't be automatically generated in.tsxfiles.