@@ -40,8 +40,6 @@ export interface MessageNumberPart extends MessageExpressionPart {
4040 parts : Intl . NumberFormatPart [ ] ;
4141}
4242
43- const NotFormattable = Symbol ( 'not-formattable' ) ;
44-
4543/**
4644 * `number` accepts a number, BigInt or string representing a JSON number as input
4745 * and formats it with the same options as
@@ -110,7 +108,6 @@ export function number(
110108 }
111109 }
112110
113- const formattable = ! options [ NotFormattable ] ;
114111 const lc = mergeLocales ( locales , input , options ) ;
115112 const num = value ;
116113 let locale : string | undefined ;
@@ -137,21 +134,17 @@ export function number(
137134 cat ??= new Intl . PluralRules ( lc , pluralOpt ) . select ( Number ( num ) ) ;
138135 return keys . has ( cat ) ? cat : null ;
139136 } ,
140- toParts : formattable
141- ? ( ) => {
142- nf ??= new Intl . NumberFormat ( lc , opt ) ;
143- const parts = nf . formatToParts ( num ) ;
144- locale ??= nf . resolvedOptions ( ) . locale ;
145- return [ { type : 'number' , source, locale, parts } ] ;
146- }
147- : undefined ,
148- toString : formattable
149- ? ( ) => {
150- nf ??= new Intl . NumberFormat ( lc , opt ) ;
151- str ??= nf . format ( num ) ;
152- return str ;
153- }
154- : undefined ,
137+ toParts ( ) {
138+ nf ??= new Intl . NumberFormat ( lc , opt ) ;
139+ const parts = nf . formatToParts ( num ) ;
140+ locale ??= nf . resolvedOptions ( ) . locale ;
141+ return [ { type : 'number' , source, locale, parts } ] ;
142+ } ,
143+ toString ( ) {
144+ nf ??= new Intl . NumberFormat ( lc , opt ) ;
145+ str ??= nf . format ( num ) ;
146+ return str ;
147+ } ,
155148 valueOf : ( ) => num
156149 } ;
157150}
0 commit comments