From 89b9879d53c39d5c707f8c7a2797d3cd8397d2f3 Mon Sep 17 00:00:00 2001 From: Orta Date: Thu, 16 Sep 2021 09:56:44 +0100 Subject: [PATCH 1/2] Adds more ResolvedDateTimeFormatOptions to the Intl APIs --- src/lib/es2021.d.ts | 1 + src/lib/es2021.intl.d.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/lib/es2021.d.ts b/src/lib/es2021.d.ts index b36544589153c..a70e09c1f5c0c 100644 --- a/src/lib/es2021.d.ts +++ b/src/lib/es2021.d.ts @@ -2,3 +2,4 @@ /// /// /// +/// diff --git a/src/lib/es2021.intl.d.ts b/src/lib/es2021.intl.d.ts index 30a84f43fae5a..d4236c82f626f 100644 --- a/src/lib/es2021.intl.d.ts +++ b/src/lib/es2021.intl.d.ts @@ -8,6 +8,15 @@ declare namespace Intl { fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined; } + interface ResolvedDateTimeFormatOptions { + formatMatcher?: "basic" | "best fit" | "best fit"; + dateStyle?: "full" | "long" | "medium" | "short"; + timeStyle?: "full" | "long" | "medium" | "short"; + hourCycle?: "h11" | "h12" | "h23" | "h24" + dayPeriod?: "narrow" | "short" | "long"; + fractionalSecondDigits?: 0 | 1 | 2 | 3; + } + interface NumberFormat { formatRange(startDate: number | bigint, endDate: number | bigint): string; formatRangeToParts(startDate: number | bigint, endDate: number | bigint): NumberFormatPart[]; From 8c60480d9d8e650c0cb35d141aec9c9c61e1626c Mon Sep 17 00:00:00 2001 From: Orta Date: Thu, 16 Sep 2021 10:11:54 +0100 Subject: [PATCH 2/2] Fix tests --- src/lib/es2021.intl.d.ts | 2 +- .../baselines/reference/formatToPartsBigInt.symbols | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/es2021.intl.d.ts b/src/lib/es2021.intl.d.ts index d4236c82f626f..2adfe49056882 100644 --- a/src/lib/es2021.intl.d.ts +++ b/src/lib/es2021.intl.d.ts @@ -12,7 +12,7 @@ declare namespace Intl { formatMatcher?: "basic" | "best fit" | "best fit"; dateStyle?: "full" | "long" | "medium" | "short"; timeStyle?: "full" | "long" | "medium" | "short"; - hourCycle?: "h11" | "h12" | "h23" | "h24" + hourCycle?: "h11" | "h12" | "h23" | "h24"; dayPeriod?: "narrow" | "short" | "long"; fractionalSecondDigits?: 0 | 1 | 2 | 3; } diff --git a/tests/baselines/reference/formatToPartsBigInt.symbols b/tests/baselines/reference/formatToPartsBigInt.symbols index 84b618f140805..1bdd0c8226002 100644 --- a/tests/baselines/reference/formatToPartsBigInt.symbols +++ b/tests/baselines/reference/formatToPartsBigInt.symbols @@ -4,16 +4,16 @@ // Test Intl methods with new parameter type new Intl.NumberFormat("fr").formatToParts(3000n); >new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) ->Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) ->Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 1 more) ->NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 2 more) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --)) >formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) new Intl.NumberFormat("fr").formatToParts(BigInt(123)); >new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) ->Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) ->Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 1 more) ->NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 2 more) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --)) >formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --)) >BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))