Skip to content

fix(types): broken nuxt v4 check#300

Merged
harlan-zw merged 2 commits into
mainfrom
fix/299-nitropack-types-nuxt4-detection
May 27, 2026
Merged

fix(types): broken nuxt v4 check#300
harlan-zw merged 2 commits into
mainfrom
fix/299-nitropack-types-nuxt4-detection

Conversation

@harlan-zw
Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #299

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

The nitropack/types augmentation added in #295 was gated on nuxt.options.future.compatibilityVersion === 4, which is unset on most Nuxt 4 projects. The check therefore silently skipped the second augmentation, leaving routeRules.robots failing typecheck with TS2353 on Nuxt 4.

Switched the gate to @nuxt/kit's isNuxtMajorVersion(4, nuxt), which reads the actual installed Nuxt version. Existing cross-module-path regression tests in test/types/templates.test-d.ts cover the fix.

…ation

The previous gate relied on `future.compatibilityVersion === 4`, which is
unset on most Nuxt 4 projects, so the `nitropack/types` augmentation never
ran and `routeRules.robots` failed type-checking with TS2353.
@harlan-zw harlan-zw force-pushed the fix/299-nitropack-types-nuxt4-detection branch from 2f397f3 to fe0f79a Compare May 27, 2026 04:37
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 27, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@nuxtjs/robots@300

commit: ad833e4

@harlan-zw harlan-zw changed the title fix: detect Nuxt 4 via isNuxtMajorVersion for nitropack/types augmentation fix(types): broken nuxt v4 check May 27, 2026
Covers the user-facing TS2353 scenario from #299. Existing tests assert
augmentation on `nitropack/types` directly; this asserts the full chain
through `NuxtConfig['routeRules']` that breaks in user configs.
@harlan-zw harlan-zw merged commit 4b02314 into main May 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Route rule augmentation missing on 'nitropack/types' causes TS2353 in nuxt config

1 participant