-
-
Notifications
You must be signed in to change notification settings - Fork 356
Part options support for $n #2170
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
Part options support for $n #2170
Conversation
Added test cases for the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for part options with the n function, allowing it to return detailed number formatting parts. Key changes include adding new test cases to verify part formatting, updating type assertions in the tests, and modifying the n function’s return type in the composer module.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
packages/vue-i18n-core/test/composer.test.ts | Added new test case “part formating with n” to verify number part formatting support |
packages/vue-i18n-core/test/composer.test-d.ts | Updated type assertions for the n function’s return type to support part formatting |
packages/vue-i18n-core/src/composer.ts | Changed the n function’s return type from string to string |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Size ReportBundles
Usages
|
@intlify/core
@intlify/core-base
@intlify/devtools-types
@intlify/message-compiler
petite-vue-i18n
@intlify/shared
vue-i18n
@intlify/vue-i18n-core
commit: |
The below comments are our notes:
|
@mauryapari If you can improve the type of my comments, please take up the challenge. If you can't, I will have someone else work on it as a separate issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If n
($n
) will pass the NumberOptions
, n
($n
) would be a good, inferred return type,
such as, pass string
or Intl.NumberFormatPart[]
to type parameter and the return type of it, or automatically infer from NumberOptions
vue-i18n/packages/vue-i18n/src/vue.d.ts
Line 849 in 2e04bed
$n(value: number, options: NumberOptions): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am new to Typescript and have tried to add the change you requested. Please have a look.
Do let me know if I might have missed something. I'll work on that.
Thanks
By improving the type of comments, do you mean should I add some details to the below new issues you opened?
Sorry if I misunderstood. Could you please clarify? |
Sorry, my poor explanation. That meas is type improvement of this PR. |
Okay Got it. Thanks. I have added type improvement as you asked. Do let me know if that is fine. :) |
Thanks! LGTM! |
part
option forn
fails with an error #1165