Nuxt UI 4 + Nuxt v4 import type issue
Hello Kapa
I installed Nuxt v4 then Nuxt UI 4
When I try to do this, which is in nuxt ui 4 documentation :
I have this error :
but it works properly
3 Replies
Hi @Omnislash. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error message you’re seeing:
suggests that TypeScript cannot find the
This is a known type export issue. If your code works, you can safely ignore the TypeScript error for now, or keep an eye out for updates to Nuxt UI and Nuxt that address this type export in a future release. The documentation is correct, but the type may not be exported in your current installed version yet.
Types not working with auto imported Components
Nuxt 4 Auto Imports Migration ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
NavigationMenuItem type in the @nuxt/ui package, even though the Nuxt UI 4 documentation shows examples using:
This is a known issue that has been reported by other users. According to a GitHub issue, this problem with auto-imported component types was fixed but the fix may not have been released at the time of the report. The documentation assumes that the type is available for import, but if you’re on a version where the fix hasn’t landed, you may see this error even though your code works at runtime.
What you can do:
- Make sure you are using the latest versions of both Nuxt and Nuxt UI.
- If the error persists but your code works, it’s likely a TypeScript type generation or export issue that will be resolved in a future release.
- You can check your local .nuxt/types/components.d.ts and .nuxt/types/imports.d.ts files to see how Nuxt has resolved your components and composable auto-imports, as suggested in the Nuxt 4 migration docs.
In summary:This is a known type export issue. If your code works, you can safely ignore the TypeScript error for now, or keep an eye out for updates to Nuxt UI and Nuxt that address this type export in a future release. The documentation is correct, but the type may not be exported in your current installed version yet.
Types not working with auto imported Components
Nuxt 4 Auto Imports Migration ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@305772639438503936> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
solved by restarting vscode