Skip to content

Commit 50e295d

Browse files
committed
Intl.NumberFormat: narrow to literal union types
1 parent f9612a0 commit 50e295d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/lib/es2020.intl.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ declare namespace Intl {
223223
): UnicodeBCP47LocaleIdentifier[];
224224
};
225225

226+
interface NumberFormatOptionsStyleRegistry {
227+
unit: any;
228+
}
229+
226230
interface NumberFormatOptionsSignDisplayRegistry {
227231
auto: any;
228232
never: any;

src/lib/es5.d.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4409,13 +4409,21 @@ declare namespace Intl {
44094409

44104410
var Collator: CollatorConstructor;
44114411

4412+
interface NumberFormatOptionsStyleRegistry {
4413+
decimal: any;
4414+
percent: any;
4415+
currency: any;
4416+
}
4417+
4418+
type NumberFormatOptionsStyle = keyof NumberFormatOptionsStyleRegistry;
4419+
44124420
interface NumberFormatOptionsUseGroupingRegistry {}
44134421

44144422
type NumberFormatOptionsUseGrouping = keyof NumberFormatOptionsUseGroupingRegistry | boolean;
44154423

44164424
interface NumberFormatOptions {
4417-
localeMatcher?: string | undefined;
4418-
style?: string | undefined;
4425+
localeMatcher?: "lookup" | "best fit" | undefined;
4426+
style?: NumberFormatOptionsStyle | undefined;
44194427
currency?: string | undefined;
44204428
currencyDisplay?: string | undefined;
44214429
useGrouping?: NumberFormatOptionsUseGrouping | undefined;
@@ -4429,7 +4437,7 @@ declare namespace Intl {
44294437
interface ResolvedNumberFormatOptions {
44304438
locale: string;
44314439
numberingSystem: string;
4432-
style: string;
4440+
style: NumberFormatOptionsStyle;
44334441
currency?: string;
44344442
currencyDisplay?: string;
44354443
minimumIntegerDigits: number;

0 commit comments

Comments
 (0)