You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the documentation it looks like that when calling VueI18n's this.$n(number, key), one could also use an object as the parameter key. This object should be similar to (if not just being to an instance of) Intl.NumberFormat.
What is actually happening?
However, in Intl.NumberFormat, useGrouping's type is boolean, meanwhile this.$n() will only accept it if it's a string:
If someone write this.$n(number, { useGrouping: false }), typescript will give the following error:
No overload matches this call.
Overload 1 of 2, '(value: number, key?: string | undefined, locale?: string | undefined): string', gave the following error.
Argument of type '{ useGrouping: boolean; }' is not assignable to parameter of type 'string'.
Overload 2 of 2, '(value: number, args?: { [key: string]: string; } | undefined): string', gave the following error.
Argument of type '{ useGrouping: boolean; }' is not assignable to parameter of type '{ [key: string]: string; }'.
Property 'useGrouping' is incompatible with index signature.
Type 'boolean' is not assignable to type 'string'.
The text was updated successfully, but these errors were encountered:
vue & vue-i18n version
Vue version 2.6.1, Vue-i18n version 8.15.1
Reproduction Link
https://jsfiddle.net/8svpywbg/2/
Steps to reproduce
Write
this.$d(123456, { useGrouping: false });
.What is Expected?
From the documentation it looks like that when calling VueI18n's
this.$n(number, key)
, one could also use an object as the parameterkey
. This object should be similar to (if not just being to an instance of)Intl.NumberFormat
.What is actually happening?
However, in
Intl.NumberFormat
,useGrouping
's type isboolean
, meanwhilethis.$n()
will only accept it if it's astring
:vue-i18n/types/index.d.ts
Line 182 in fc110cd
If someone write
this.$n(number, { useGrouping: false })
, typescript will give the following error:The text was updated successfully, but these errors were encountered: