Skip to content

fix(i18n): add explicit type annotation for i18n export#4856

Merged
weareoutman merged 1 commit intov3from
fix/i18n-type-annotation
Feb 6, 2026
Merged

fix(i18n): add explicit type annotation for i18n export#4856
weareoutman merged 1 commit intov3from
fix/i18n-type-annotation

Conversation

@willc001
Copy link
Contributor

@willc001 willc001 commented Feb 6, 2026

Add I18n type annotation to ensure type safety and better IDE support.

依赖检查

组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。

请勾选以下两组选项其中之一:

  • 本次 MR 没有使用上游组件(例如框架、后台组件等)的较新版本提供的特性。

或者:

  • 本次 MR 使用了上游组件(例如框架、后台组件等)的较新版本提供的特性。
  • 在对应的文件中更新了该上游组件的依赖版本(或确认了当前声明的依赖版本已包含本次 MR 使用的新特性)。

提交信息检查

Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。

破坏性变更是针对于下游使用者而言,可以通过本次改动对下游使用者的影响来识别变更类型:

  • 下游使用者不做任何改动,仍可以正常工作时,那么它属于普通变更。
  • 反之,下游使用者不做改动就无法正常工作时,那么它属于破坏性变更。

例如,构件修改了一个属性名,小产品 Storyboard 中需要使用新属性名才能工作,那么它就是破坏性变更。
又例如,构件还没有任何下游使用者,那么它的任何变更都是普通变更。

破坏性变更:

  • ⚠️ 本次 MR 包含破坏性变更的提交,请继续确认以下所有选项:
  • 没有更好的兼容方案,必须做破坏性变更。
  • 使用了 feat 作为提交类型。
  • 标注了 BREAKING CHANGE: 你的变更说明
  • 同时更新了本仓库中所有下游使用者的调用。
  • 同时更新了本仓库中所有下游使用者对该子包的依赖为即将发布的 major 版本。
  • 同时为其它仓库的 Migrating 做好了准备,例如文档或批量改动的方法。
  • 手动验证过破坏性变更在 Migrate 后可以正常工作。
  • 破坏性变更所在的提交没有意外携带其它子包的改动。

新特性:

  • 本次 MR 包含新特性的提交,且该提交不带有破坏性变更,并使用了 feat 作为提交类型。
  • 给新特性添加了单元测试。
  • 手动验证过新特性可以正常工作。

问题修复:

  • 本次 MR 包含问题修复的提交,且该提交不带有新特性或破坏性变更,并使用了 fix 作为提交类型。
  • 给问题修复添加了单元测试。
  • 手动验证过问题修复得到解决。

杂项工作:

即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:

  • 本次 MR 包含杂项工作的提交,且该提交不带有问题修复、新特性或破坏性变更,并使用了 chore, docs, test 等作为提交类型。

Summary by CodeRabbit

发布说明

  • 其他优化
    • 改进了 i18n 模块的类型注解,增强代码类型安全性。

Add I18n type annotation to ensure type safety and better IDE support.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Walkthrough

packages/i18n/src/index.ts 中添加了从 i18next 导入的 I18n 类型,为导出的 i18n 常数增加了显式类型注解。运行时行为保持不变。

Changes

Cohort / File(s) Summary
类型注解增强
packages/i18n/src/index.ts
为导出的 i18n 常数添加显式类型注解 I18n,引入 I18n 类型导入,不改变运行时逻辑。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确地概括了主要变更:为i18n导出添加显式类型注解。
Description check ✅ Passed 描述包含了必要的信息,已完成依赖检查和提交信息检查部分。作者正确选择了「问题修复」类别,但未勾选测试相关项。
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
  • Commit unit tests in branch fix/i18n-type-annotation

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.

@cypress
Copy link

cypress bot commented Feb 6, 2026

next-core    Run #11930

Run Properties:  status check passed Passed #11930  •  git commit 8474c96eb7 ℹ️: Merge 6fc46527828f14eb2968dd4857fa32e554507381 into a752ddb014e8ceddad83b2932140...
Project next-core
Branch Review fix/i18n-type-annotation
Run status status check passed Passed #11930
Run duration 00m 26s
Commit git commit 8474c96eb7 ℹ️: Merge 6fc46527828f14eb2968dd4857fa32e554507381 into a752ddb014e8ceddad83b2932140...
Committer William Cai
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 17
View all changes introduced in this branch ↗︎

@weareoutman weareoutman merged commit 4257a64 into v3 Feb 6, 2026
9 checks passed
@weareoutman weareoutman deleted the fix/i18n-type-annotation branch February 6, 2026 03:52
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.

2 participants