Skip to content

fix: type pollution through shared-imports.d#3923

Merged
BobbieGoede merged 1 commit intonuxt-modules:mainfrom
BobbieGoede:fix/typecheck-shared-type
Feb 4, 2026
Merged

fix: type pollution through shared-imports.d#3923
BobbieGoede merged 1 commit intonuxt-modules:mainfrom
BobbieGoede:fix/typecheck-shared-type

Conversation

@BobbieGoede
Copy link
Copy Markdown
Member

@BobbieGoede BobbieGoede commented Feb 4, 2026

🔗 Linked issue

📚 Description

The types added to tsconfig need to be reworked in this module, and it would be good to rework the composable exports to prevent accidentally importing things that are not available in certain contexts (shared/nuxt/nitro).

Typecheck fails in Nuxt 4.3.0 due to the following (used as type only) import { useHead } from '#imports';, this was not an issue in previous releases. This might be something more modules will run into /cc @danielroe - related to nuxt/nuxt#34142.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved type consistency for head-related properties across different Nuxt app versions.

@BobbieGoede BobbieGoede self-assigned this Feb 4, 2026
@BobbieGoede BobbieGoede changed the title fix: type pollution in shared-imports.d fix: type pollution through shared-imports.d Feb 4, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 4, 2026

npm i https://pkg.pr.new/@nuxtjs/i18n@3923

commit: 62bec7f

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

This pull request updates type definitions in the ComposableContext type within src/runtime/utils.ts. The head and _head properties now resolve their types through a dynamic import path from 'nuxt/app' rather than direct local symbol references. Specifically, ReturnType<typeof useHead> is replaced with ReturnType<typeof import('nuxt/app').useHead> in both property definitions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title references fixing 'type pollution in shared-imports.d', but the actual changes are in src/runtime/utils.ts, modifying the ComposableContext type definitions. The title is unrelated to the file being changed. Update the title to reflect the actual changes, such as 'fix: resolve useHead type references in ComposableContext' or similar, to accurately describe the modifications made to src/runtime/utils.ts.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The code changes directly address issue #3917 by removing type pollution from shared imports, preventing accidental symbol imports in non-app contexts.
Out of Scope Changes check ✅ Passed All changes in src/runtime/utils.ts are scoped to fixing type resolution for the ComposableContext, directly addressing the linked issue without extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BobbieGoede BobbieGoede merged commit fb76114 into nuxt-modules:main Feb 4, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typecheck errors with latest Nuxt v4.3.0 update

1 participant