Skip to content

fix(types): type the i18n config key with the augmentable ModuleOptions interface - #4139

Open
lazerg wants to merge 1 commit into
nuxt-modules:mainfrom
lazerg:fix/issue-4138-module-options-augmentation
Open

fix(types): type the i18n config key with the augmentable ModuleOptions interface#4139
lazerg wants to merge 1 commit into
nuxt-modules:mainfrom
lazerg:fix/issue-4138-module-options-augmentation

Conversation

@lazerg

@lazerg lazerg commented Aug 15, 2026

Copy link
Copy Markdown

🔗 Linked issue

📚 Description

ModuleOptions is an interface, so companion modules can extend it through declaration merging. The i18n key on NuxtConfig and NuxtOptions is typed with the UserNuxtI18nOptions alias instead, which an augmentation never reaches, so adding a custom key under i18n fails with TS2353 even though the value survives at runtime.

Both keys now point at ModuleOptions. It extends UserNuxtI18nOptions and adds no members, so the exposed type stays the same and only augmentability changes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved TypeScript support for internationalization configuration in Nuxt projects.
    • Configuration options now provide more accurate and consistent type checking across Nuxt configuration contexts.
    • Helps surface invalid settings earlier and improves editor autocomplete when configuring internationalization.

@lazerg
lazerg requested a review from BobbieGoede as a code owner August 15, 2026 01:01
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ff6c48fa-7a4e-4cef-824f-24a15efe0463

📥 Commits

Reviewing files that changed from the base of the PR and between 6a72568 and be80662.

📒 Files selected for processing (1)
  • src/module.ts

Walkthrough

The Nuxt module augmentation now types NuxtConfig['i18n'] as Partial<ModuleOptions> and NuxtOptions['i18n'] as ModuleOptions. Both declarations previously used UserNuxtI18nOptions.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to be806

This localized type-only change makes the i18n configuration keys augmentable without changing runtime behavior, and no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the type change that enables augmentation of the i18n configuration key.
Linked Issues check ✅ Passed The changes address issue #4138 by typing NuxtConfig and NuxtOptions i18n keys with the augmentable ModuleOptions interface.
Out of Scope Changes check ✅ Passed The pull request changes only the i18n type declarations required to support ModuleOptions augmentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

NuxtConfig['i18n'] is typed via a type alias, so it cannot be augmented by other modules

1 participant