N
Nuxt3mo ago
Omnislash

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 :
import type { NavigationMenuItem } from '@nuxt/ui'
import type { NavigationMenuItem } from '@nuxt/ui'
I have this error :
Module '"@nuxt/ui"' has no exported member 'NavigationMenuItem'. Did you mean to use 'import NavigationMenuItem from "@nuxt/ui"' instead?ts(2614)
Module '"@nuxt/ui"' has no exported member 'NavigationMenuItem'. Did you mean to use 'import NavigationMenuItem from "@nuxt/ui"' instead?ts(2614)
but it works properly
3 Replies
kapa.ai
kapa.ai3mo ago
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:
Module '"@nuxt/ui"' has no exported member 'NavigationMenuItem'. Did you mean to use 'import NavigationMenuItem from "@nuxt/ui"' instead?ts(2614)
Module '"@nuxt/ui"' has no exported member 'NavigationMenuItem'. Did you mean to use 'import NavigationMenuItem from "@nuxt/ui"' instead?ts(2614)
suggests that TypeScript cannot find the NavigationMenuItem type in the @nuxt/ui package, even though the Nuxt UI 4 documentation shows examples using:
import type { NavigationMenuItem } from '@nuxt/ui'
import type { NavigationMenuItem } from '@nuxt/ui'
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: ----------------------
kapa.ai
kapa.ai3mo ago
<@305772639438503936> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Omnislash
OmnislashOP3mo ago
solved by restarting vscode

Did you find this page helpful?