mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Adds more Intl.ResolvedDateTimeFormatOptions, and hooks up Intl for ES2021 (#45905)
* Adds more ResolvedDateTimeFormatOptions to the Intl APIs * Fix tests
This commit is contained in:
parent
a4f9bf0fce
commit
61d2939359
1
src/lib/es2021.d.ts
vendored
1
src/lib/es2021.d.ts
vendored
@ -2,3 +2,4 @@
|
||||
/// <reference lib="es2021.promise" />
|
||||
/// <reference lib="es2021.string" />
|
||||
/// <reference lib="es2021.weakref" />
|
||||
/// <reference lib="es2021.intl" />
|
||||
|
||||
9
src/lib/es2021.intl.d.ts
vendored
9
src/lib/es2021.intl.d.ts
vendored
@ -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[];
|
||||
|
||||
@ -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, --, --))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user