Skip to content

Intl.NumberFormat: Add latest options, fix previous library discrepancies #56902

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 23 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
df89080
Intl.NumberFormat: fix previous divergences from spec
Renegade334 Dec 30, 2023
f9612a0
Intl.NumberFormat: add ECMA-402 version 10 changes under es2023.intl
Renegade334 Dec 30, 2023
50e295d
Intl.NumberFormat: narrow to literal union types
Renegade334 Dec 30, 2023
7a9f949
Intl.NumberFormat: move ES23 methods from esnext.intl to es2023.intl
Renegade334 Dec 30, 2023
ef87a15
es2023.intl: CRLF
Renegade334 Dec 30, 2023
8b96367
es2023.intl: Fix interface names
Renegade334 Dec 30, 2023
0b137b9
Intl.NumberFormat: conditional type override for useGrouping
Renegade334 Dec 30, 2023
bb13158
Intl.NumberFormat: add false to ResolvedNumberFormatOptionsUseGrouping
Renegade334 Dec 30, 2023
b857806
Intl.NumberFormat: narrow currencyDisplay type
Renegade334 Dec 30, 2023
481c244
Intl.NumberFormat: narrow currencySign type
Renegade334 Dec 30, 2023
0734e7a
es2020.intl: make NumberFormatOptions.numberingSystem optional
Renegade334 Dec 31, 2023
d0876e5
Update baselines to include lib.es2023.intl.d.ts
Renegade334 Dec 31, 2023
72f7d44
Add conformance tests for es2020.intl / es2023.intl
Renegade334 Dec 31, 2023
7b73dc7
Intl.NumberFormat: remove duplicate method override from es2020.bigint
Renegade334 Dec 31, 2023
6ee47d4
Intl.NumberFormat: Registry-ise NumberFormatPartType
Renegade334 Dec 31, 2023
f8e9dda
Intl.NumberFormatPartType: add tests / update baselines
Renegade334 Dec 31, 2023
ca699fc
Restore name of exported type Intl.NumberFormatPartTypes
Renegade334 Dec 31, 2023
40cdb05
Move NumberFormat#formatRange tests from ES2021 to ES2023
Renegade334 Dec 31, 2023
a6261f9
Remove test formatToPartsBigInt (duplicate of tests included in bigin…
Renegade334 Dec 31, 2023
90b7d94
Merge branch 'main' into intl-numberformat
Renegade334 Jan 3, 2024
37c5d52
Type string registry interfaces as {key: never}
Renegade334 Feb 1, 2024
ff58e75
ResolvedNumberFormatOptions: {minimum,maximum}FractionDigits to optional
Renegade334 Feb 2, 2024
254a8ce
Merge branch 'main' into intl-numberformat
Renegade334 Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Type string registry interfaces as {key: never}
  • Loading branch information
Renegade334 committed Feb 1, 2024
commit 37c5d527b960bfff38a8bc6a09bbee9c30ffaa1f
24 changes: 12 additions & 12 deletions src/lib/es2018.intl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ declare namespace Intl {
const PluralRules: PluralRulesConstructor;

interface NumberFormatPartTypeRegistry {
literal: any;
nan: any;
infinity: any;
percent: any;
integer: any;
group: any;
decimal: any;
fraction: any;
plusSign: any;
minusSign: any;
percentSign: any;
currency: any;
literal: never;
nan: never;
infinity: never;
percent: never;
integer: never;
group: never;
decimal: never;
fraction: never;
plusSign: never;
minusSign: never;
percentSign: never;
currency: never;
}

type NumberFormatPartTypes = keyof NumberFormatPartTypeRegistry;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/es2019.intl.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
unknown: any;
unknown: never;
}
}
24 changes: 12 additions & 12 deletions src/lib/es2020.intl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@ declare namespace Intl {
};

interface NumberFormatOptionsStyleRegistry {
unit: any;
unit: never;
}

interface NumberFormatOptionsCurrencyDisplayRegistry {
narrowSymbol: any;
narrowSymbol: never;
}

interface NumberFormatOptionsSignDisplayRegistry {
auto: any;
never: any;
always: any;
exceptZero: any;
auto: never;
never: never;
always: never;
exceptZero: never;
}

type NumberFormatOptionsSignDisplay = keyof NumberFormatOptionsSignDisplayRegistry;
Copy link
Member

Choose a reason for hiding this comment

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

ES2020

  • auto
  • never
  • always
  • exceptZero

ES2023

  • negative

Expand All @@ -260,12 +260,12 @@ declare namespace Intl {
}

interface NumberFormatPartTypeRegistry {
compact: any;
exponentInteger: any;
exponentMinusSign: any;
exponentSeparator: any;
unit: any;
unknown: any;
compact: never;
exponentInteger: never;
exponentMinusSign: never;
exponentSeparator: never;
unit: never;
unknown: never;
}

interface DateTimeFormatOptions {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/es2023.intl.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
declare namespace Intl {
interface NumberFormatOptionsUseGroupingRegistry {
min2: any;
auto: any;
always: any;
min2: never;
auto: never;
always: never;
}

interface NumberFormatOptionsSignDisplayRegistry {
negative: any;
negative: never;
}

interface NumberFormatOptions {
Expand Down
12 changes: 6 additions & 6 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4410,17 +4410,17 @@ declare namespace Intl {
var Collator: CollatorConstructor;

interface NumberFormatOptionsStyleRegistry {
decimal: any;
percent: any;
currency: any;
decimal: never;
percent: never;
currency: never;
}

type NumberFormatOptionsStyle = keyof NumberFormatOptionsStyleRegistry;
Copy link
Member

Choose a reason for hiding this comment

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

ES5

  • decimal
  • percent
  • currency

ES2020

  • unit


interface NumberFormatOptionsCurrencyDisplayRegistry {
code: any;
symbol: any;
name: any;
code: never;
symbol: never;
name: never;
}

type NumberFormatOptionsCurrencyDisplay = keyof NumberFormatOptionsCurrencyDisplayRegistry;
Copy link
Member

Choose a reason for hiding this comment

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

ES5

  • code
  • symbol
  • name

ES2020

  • narrowSymbol

Expand Down