diff --git a/src/lib/esnext.intl.d.ts b/src/lib/esnext.intl.d.ts index 95608636119c4..2f2f021f8750e 100644 --- a/src/lib/esnext.intl.d.ts +++ b/src/lib/esnext.intl.d.ts @@ -7,6 +7,6 @@ declare namespace Intl { } interface NumberFormat { - formatToParts(number?: number): NumberFormatPart[]; + formatToParts(number?: number | bigint): NumberFormatPart[]; } } diff --git a/tests/baselines/reference/formatToPartsBigInt.js b/tests/baselines/reference/formatToPartsBigInt.js new file mode 100644 index 0000000000000..1c53ccb24de6c --- /dev/null +++ b/tests/baselines/reference/formatToPartsBigInt.js @@ -0,0 +1,13 @@ +//// [formatToPartsBigInt.ts] +// Intl.NumberFormat.formatToParts should support bigInt + +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").formatToParts(3000n); +new Intl.NumberFormat("fr").formatToParts(BigInt(123)); + + +//// [formatToPartsBigInt.js] +// Intl.NumberFormat.formatToParts should support bigInt +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").formatToParts(3000n); +new Intl.NumberFormat("fr").formatToParts(BigInt(123)); diff --git a/tests/baselines/reference/formatToPartsBigInt.symbols b/tests/baselines/reference/formatToPartsBigInt.symbols new file mode 100644 index 0000000000000..f3037bfef10ed --- /dev/null +++ b/tests/baselines/reference/formatToPartsBigInt.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/formatToPartsBigInt.ts === +// Intl.NumberFormat.formatToParts should support bigInt + +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").formatToParts(3000n); +>new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.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 1 more) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.intl.d.ts, --, --)) +>formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) + +new Intl.NumberFormat("fr").formatToParts(BigInt(123)); +>new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) +>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.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 1 more) +>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.esnext.intl.d.ts, --, --)) +>formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.esnext.intl.d.ts, --, --)) +>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --)) + diff --git a/tests/baselines/reference/formatToPartsBigInt.types b/tests/baselines/reference/formatToPartsBigInt.types new file mode 100644 index 0000000000000..fc911ed065711 --- /dev/null +++ b/tests/baselines/reference/formatToPartsBigInt.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/formatToPartsBigInt.ts === +// Intl.NumberFormat.formatToParts should support bigInt + +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").formatToParts(3000n); +>new Intl.NumberFormat("fr").formatToParts(3000n) : Intl.NumberFormatPart[] +>new Intl.NumberFormat("fr").formatToParts : (number?: number | bigint) => Intl.NumberFormatPart[] +>new Intl.NumberFormat("fr") : Intl.NumberFormat +>Intl.NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>Intl : typeof Intl +>NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>"fr" : "fr" +>formatToParts : (number?: number | bigint) => Intl.NumberFormatPart[] +>3000n : 3000n + +new Intl.NumberFormat("fr").formatToParts(BigInt(123)); +>new Intl.NumberFormat("fr").formatToParts(BigInt(123)) : Intl.NumberFormatPart[] +>new Intl.NumberFormat("fr").formatToParts : (number?: number | bigint) => Intl.NumberFormatPart[] +>new Intl.NumberFormat("fr") : Intl.NumberFormat +>Intl.NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>Intl : typeof Intl +>NumberFormat : { (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; new (locales?: string | string[], options?: Intl.NumberFormatOptions): Intl.NumberFormat; supportedLocalesOf(locales: string | string[], options?: Intl.NumberFormatOptions): string[]; } +>"fr" : "fr" +>formatToParts : (number?: number | bigint) => Intl.NumberFormatPart[] +>BigInt(123) : bigint +>BigInt : BigIntConstructor +>123 : 123 + diff --git a/tests/cases/compiler/formatToPartsBigInt.ts b/tests/cases/compiler/formatToPartsBigInt.ts new file mode 100644 index 0000000000000..6b50e98b8b6ea --- /dev/null +++ b/tests/cases/compiler/formatToPartsBigInt.ts @@ -0,0 +1,7 @@ +// @target: esnext + +// Intl.NumberFormat.formatToParts should support bigInt + +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").formatToParts(3000n); +new Intl.NumberFormat("fr").formatToParts(BigInt(123));