Skip to content

Fix declaration order in Number formatting with options ResourceKeys must be before OptionsType #2205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2025

Conversation

louis49
Copy link
Contributor

@louis49 louis49 commented Jun 17, 2025

Fix build error since 11.1.5 with vue-tsc :

node_modules/vue-i18n/dist/vue-i18n.d.ts:3814:43 - error TS2744: Type parameter defaults can only reference previously declared type parameters.

3814 OptionsType = DateTimeOptions<Key | ResourceKeys>,
~~~~~~~~~~~~

node_modules/vue-i18n/dist/vue-i18n.d.ts:4022:41 - error TS2744: Type parameter defaults can only reference previously declared type parameters.

4022 OptionsType = NumberOptions<Key | ResourceKeys>,
~~~~~~~~~~~~

Summary by CodeRabbit

  • Refactor
    • Improved type parameter order for datetime and number formatting methods to enhance type safety and consistency. No changes to user-facing functionality.

…must be before OptionsType for DateTimeOptions and NumberOptions
Copy link

coderabbitai bot commented Jun 17, 2025

Walkthrough

The change updates the order of generic type parameters for the $d (datetime formatting) and $n (number formatting) methods in the Vue i18n TypeScript typings. The ResourceKeys type parameter is now declared before OptionsType to ensure proper type dependency resolution. No runtime or logic changes are made.

Changes

File(s) Change Summary
packages/vue-i18n/src/vue.d.ts Reordered generic type parameters for $d and $n method overloads to resolve type dependencies.

Sequence Diagram(s)

Not applicable: The change is limited to type parameter ordering and does not affect control flow or introduce new features.

Possibly related PRs

Suggested labels

Type: Bug

Poem

A hop and a skip through the typing grass,
Where generics line up and let errors pass.
$d and $n now know their place,
ResourceKeys first, a tidy embrace.
The rabbit approves with a wiggle and grin—
Type order restored, let the formatting begin! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c7573e and a8f6a15.

📒 Files selected for processing (1)
  • packages/vue-i18n/src/vue.d.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/vue-i18n/src/vue.d.ts (3)
packages/core-base/src/types/utils.ts (1)
  • IsNever (6-6)
packages/core-base/src/datetime.ts (1)
  • DateTimeOptions (80-103)
packages/core-base/src/number.ts (1)
  • NumberOptions (78-101)
🔇 Additional comments (2)
packages/vue-i18n/src/vue.d.ts (2)

613-615: Correct generic parameter order in $d overload
Reordering ResourceKeys before OptionsType prevents OptionsType = DateTimeOptions<Key | ResourceKeys> from referencing an undeclared type parameter. This aligns with TypeScript’s requirement and fixes the build error.


680-682: Correct generic parameter order in $n overload
Moving ResourceKeys before OptionsType ensures that OptionsType = NumberOptions<Key | ResourceKeys> no longer references a type parameter declared later, resolving the TS error.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Size Report

Bundles

File Size Gzip Brotli
core.esm-browser.prod.js 38.05 kB 11.62 kB 10.39 kB
core.global.prod.js 31.11 kB 10.78 kB 9.67 kB
core.runtime.esm-browser.prod.js 23.77 kB 7.71 kB 6.90 kB
core.runtime.global.prod.js 18.08 kB 7.04 kB 6.32 kB
message-compiler.esm-browser.prod.js 19.29 kB 5.76 kB 5.14 kB
message-compiler.global.prod.js 17.32 kB 5.55 kB 4.98 kB
petite-vue-i18n-core.esm-browser.prod.js 20.70 kB 6.98 kB 6.27 kB
petite-vue-i18n-core.global.prod.js 15.66 kB 6.08 kB 5.51 kB
petite-vue-i18n.esm-browser.prod.js 37.01 kB 11.36 kB 10.19 kB
petite-vue-i18n.global.prod.js 29.87 kB 10.21 kB 9.22 kB
petite-vue-i18n.runtime.esm-browser.prod.js 22.58 kB 7.35 kB 6.64 kB
petite-vue-i18n.runtime.global.prod.js 16.86 kB 6.42 kB 5.82 kB
vue-i18n.esm-browser.prod.js 50.71 kB 15.17 kB 13.56 kB
vue-i18n.global.prod.js 40.57 kB 13.63 kB 12.25 kB
vue-i18n.runtime.esm-browser.prod.js 36.28 kB 11.17 kB 10.03 kB
vue-i18n.runtime.global.prod.js 27.56 kB 9.88 kB 8.91 kB

Usages

Name Size Gzip Brotli
packages/size-check-core (@intlify/core) 9.22 kB 3.82 kB 3.46 kB
packages/size-check-petite-vue-i18n (petite-vue-i18n) 77.63 kB 30.24 kB 27.28 kB
packages/size-check-vue-i18n (vue-i18n) 82.85 kB 31.74 kB 28.64 kB

Copy link

pkg-pr-new bot commented Jun 22, 2025

Open in StackBlitz

@intlify/core

npm i https://pkg.pr.new/@intlify/core@2205

@intlify/core-base

npm i https://pkg.pr.new/@intlify/core-base@2205

@intlify/devtools-types

npm i https://pkg.pr.new/@intlify/devtools-types@2205

@intlify/message-compiler

npm i https://pkg.pr.new/@intlify/message-compiler@2205

petite-vue-i18n

npm i https://pkg.pr.new/petite-vue-i18n@2205

@intlify/shared

npm i https://pkg.pr.new/@intlify/shared@2205

vue-i18n

npm i https://pkg.pr.new/vue-i18n@2205

@intlify/vue-i18n-core

npm i https://pkg.pr.new/@intlify/vue-i18n-core@2205

commit: a8f6a15

@kazupon kazupon added Type: Bug Bug or Bug fixes 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Jun 22, 2025
Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@kazupon kazupon merged commit 9589f23 into intlify:master Jun 22, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants