Update bigint declaration file (#38526)

* update toLocalString function signature

* update test.

* fix lint

* follow review advice.

* format and better comment.

* format

* add case

* fix symbol.

* remove subtype and string union in interface.

* remove useless code.

Co-authored-by: Song Gao <song.gao@laserfiche.com>
This commit is contained in:
ShuiRuTian
2020-06-23 05:55:04 +08:00
committed by GitHub
parent d10beaa8b5
commit d76e85d94e
11 changed files with 479 additions and 122 deletions

View File

@@ -1,3 +1,89 @@
interface BigIntToLocaleStringOptions {
/**
* The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
*/
localeMatcher?: string;
/**
* The formatting style to use , the default is "decimal".
*/
style?: string;
numberingSystem?: string;
/**
* The unit to use in unit formatting, Possible values are core unit identifiers, defined in UTS #35, Part 2, Section 6. A subset of units from the full list was selected for use in ECMAScript. Pairs of simple units can be concatenated with "-per-" to make a compound unit. There is no default value; if the style is "unit", the unit property must be provided.
*/
unit?: string;
/**
* The unit formatting style to use in unit formatting, the defaults is "short".
*/
unitDisplay?: string;
/**
* The currency to use in currency formatting. Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar, "EUR" for the euro, or "CNY" for the Chinese RMB — see the Current currency & funds code list. There is no default value; if the style is "currency", the currency property must be provided. It is only used when [[Style]] has the value "currency".
*/
currency?: string;
/**
* How to display the currency in currency formatting. It is only used when [[Style]] has the value "currency". The default is "symbol".
*
* "symbol" to use a localized currency symbol such as €,
*
* "code" to use the ISO currency code,
*
* "name" to use a localized currency name such as "dollar"
*/
currencyDisplay?: string;
/**
* Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. The default is true.
*/
useGrouping?: boolean;
/**
* The minimum number of integer digits to use. Possible values are from 1 to 21; the default is 1.
*/
minimumIntegerDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The minimum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information).
*/
minimumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
/**
* The maximum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number formatting is the larger of minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits and the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information); the default for percent formatting is the larger of minimumFractionDigits and 0.
*/
maximumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
/**
* The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1.
*/
minimumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21.
*/
maximumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The formatting that should be displayed for the number, the defaults is "standard"
*
* "standard" plain number formatting
*
* "scientific" return the order-of-magnitude for formatted number.
*
* "engineering" return the exponent of ten when divisible by three
*
* "compact" string representing exponent, defaults is using the "short" form
*/
notation?: string;
/**
* used only when notation is "compact"
*/
compactDisplay?: string;
}
interface BigInt {
/**
* Returns a string representation of an object.
@@ -6,7 +92,7 @@ interface BigInt {
toString(radix?: number): string;
/** Returns a string representation appropriate to the host environment's current locale. */
toLocaleString(): string;
toLocaleString(locales?: string, options?: BigIntToLocaleStringOptions): string;
/** Returns the primitive value of the specified object. */
valueOf(): bigint;
@@ -613,3 +699,10 @@ interface DataView {
*/
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
}
declare namespace Intl{
interface NumberFormat {
format(value: number | bigint): string;
resolvedOptions(): ResolvedNumberFormatOptions;
}
}

View File

@@ -1,5 +1,5 @@
tests/cases/compiler/bigintWithLib.ts(4,1): error TS2350: Only a void function can be called with the 'new' keyword.
tests/cases/compiler/bigintWithLib.ts(16,33): error TS2769: No overload matches this call.
tests/cases/compiler/bigintWithLib.ts(19,33): error TS2769: No overload matches this call.
Overload 1 of 3, '(length?: number): BigInt64Array', gave the following error.
Argument of type 'number[]' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(array: Iterable<bigint>): BigInt64Array', gave the following error.
@@ -12,8 +12,8 @@ tests/cases/compiler/bigintWithLib.ts(16,33): error TS2769: No overload matches
Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'.
Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
tests/cases/compiler/bigintWithLib.ts(28,35): error TS2769: No overload matches this call.
tests/cases/compiler/bigintWithLib.ts(24,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
tests/cases/compiler/bigintWithLib.ts(31,35): error TS2769: No overload matches this call.
Overload 1 of 3, '(length?: number): BigUint64Array', gave the following error.
Argument of type 'number[]' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(array: Iterable<bigint>): BigUint64Array', gave the following error.
@@ -21,9 +21,9 @@ tests/cases/compiler/bigintWithLib.ts(28,35): error TS2769: No overload matches
Overload 3 of 3, '(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBufferLike'.
Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
tests/cases/compiler/bigintWithLib.ts(36,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
tests/cases/compiler/bigintWithLib.ts(43,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
tests/cases/compiler/bigintWithLib.ts(46,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'.
==== tests/cases/compiler/bigintWithLib.ts (7 errors) ====
@@ -39,6 +39,9 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type 'nu
let stringVal: string = bigintVal.toString();
stringVal = bigintVal.toString(2);
stringVal = bigintVal.toLocaleString();
stringVal = bigintVal.toLocaleString('de-DE');
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' });
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' })
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
@@ -113,4 +116,8 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type 'nu
const x = -12n; // should emit as const x = -12n
const y: 12n = 12n; // should emit type 12n
let z = 12n; // should emit type bigint in declaration file
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
new Intl.NumberFormat("fr").format(bigintVal);

View File

@@ -9,6 +9,9 @@ bigintVal = bigintVal.valueOf();
let stringVal: string = bigintVal.toString();
stringVal = bigintVal.toString(2);
stringVal = bigintVal.toLocaleString();
stringVal = bigintVal.toLocaleString('de-DE');
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' });
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' })
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
@@ -52,6 +55,10 @@ const w = 12n; // should emit as const w = 12n
const x = -12n; // should emit as const x = -12n
const y: 12n = 12n; // should emit type 12n
let z = 12n; // should emit type bigint in declaration file
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
new Intl.NumberFormat("fr").format(bigintVal);
//// [bigintWithLib.js]
@@ -65,6 +72,9 @@ bigintVal = bigintVal.valueOf();
let stringVal = bigintVal.toString();
stringVal = bigintVal.toString(2);
stringVal = bigintVal.toLocaleString();
stringVal = bigintVal.toLocaleString('de-DE');
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' });
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' });
// Test BigInt64Array
let bigIntArray = new BigInt64Array();
bigIntArray = new BigInt64Array(10);
@@ -104,6 +114,9 @@ const w = 12n; // should emit as const w = 12n
const x = -12n; // should emit as const x = -12n
const y = 12n; // should emit type 12n
let z = 12n; // should emit type bigint in declaration file
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
new Intl.NumberFormat("fr").format(bigintVal);
//// [bigintWithLib.d.ts]

View File

@@ -47,173 +47,210 @@ stringVal = bigintVal.toLocaleString();
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
stringVal = bigintVal.toLocaleString('de-DE');
>stringVal : Symbol(stringVal, Decl(bigintWithLib.ts, 7, 3))
>bigintVal.toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' });
>stringVal : Symbol(stringVal, Decl(bigintWithLib.ts, 7, 3))
>bigintVal.toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
>style : Symbol(style, Decl(bigintWithLib.ts, 11, 47))
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' })
>stringVal : Symbol(stringVal, Decl(bigintWithLib.ts, 7, 3))
>bigintVal.toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
>style : Symbol(style, Decl(bigintWithLib.ts, 12, 47))
>currency : Symbol(currency, Decl(bigintWithLib.ts, 12, 66))
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigIntArray = new BigInt64Array(10);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigIntArray = new BigInt64Array([1n, 2n, 3n]);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigIntArray = new BigInt64Array([1, 2, 3]); // should error
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigIntArray = new BigInt64Array(new ArrayBuffer(80));
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
let len: number = bigIntArray.length;
>len : Symbol(len, Decl(bigintWithLib.ts, 19, 3))
>len : Symbol(len, Decl(bigintWithLib.ts, 22, 3))
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
bigIntArray.length = 10; // should error
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
let arrayBufferLike: ArrayBufferView = bigIntArray;
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithLib.ts, 21, 3))
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithLib.ts, 24, 3))
>ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
// Test BigUint64Array
let bigUintArray: BigUint64Array = new BigUint64Array();
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 27, 3))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigUintArray = new BigUint64Array(10);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 27, 3))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigUintArray = new BigUint64Array([1n, 2n, 3n]);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 27, 3))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigUintArray = new BigUint64Array([1, 2, 3]); // should error
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 27, 3))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
bigUintArray = new BigUint64Array(new ArrayBuffer(80));
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 27, 3))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 27, 3))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 27, 3))
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
len = bigIntArray.length;
>len : Symbol(len, Decl(bigintWithLib.ts, 19, 3))
>len : Symbol(len, Decl(bigintWithLib.ts, 22, 3))
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
bigIntArray.length = 10; // should error
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
arrayBufferLike = bigIntArray;
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithLib.ts, 21, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithLib.ts, 24, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3))
// Test added DataView methods
const dataView = new DataView(new ArrayBuffer(80));
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>DataView : Symbol(DataView, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
dataView.setBigInt64(1, -1n);
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
dataView.setBigInt64(1, -1n, true);
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
dataView.setBigInt64(1, -1); // should error
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
dataView.setBigUint64(2, 123n);
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
dataView.setBigUint64(2, 123n, true);
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
dataView.setBigUint64(2, 123); // should error
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
bigintVal = dataView.getBigInt64(1);
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>dataView.getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
bigintVal = dataView.getBigInt64(1, true);
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>dataView.getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
bigintVal = dataView.getBigUint64(2);
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>dataView.getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
bigintVal = dataView.getBigUint64(2, true);
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
>dataView.getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 39, 5))
>getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
// Test emitted declarations files
const w = 12n; // should emit as const w = 12n
>w : Symbol(w, Decl(bigintWithLib.ts, 49, 5))
>w : Symbol(w, Decl(bigintWithLib.ts, 52, 5))
const x = -12n; // should emit as const x = -12n
>x : Symbol(x, Decl(bigintWithLib.ts, 50, 5))
>x : Symbol(x, Decl(bigintWithLib.ts, 53, 5))
const y: 12n = 12n; // should emit type 12n
>y : Symbol(y, Decl(bigintWithLib.ts, 51, 5))
>y : Symbol(y, Decl(bigintWithLib.ts, 54, 5))
let z = 12n; // should emit type bigint in declaration file
>z : Symbol(z, Decl(bigintWithLib.ts, 52, 3))
>z : Symbol(z, Decl(bigintWithLib.ts, 55, 3))
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
>new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.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.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, --, --))
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
new Intl.NumberFormat("fr").format(bigintVal);
>new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.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.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, --, --))
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))

View File

@@ -66,9 +66,44 @@ stringVal = bigintVal.toLocaleString();
>stringVal = bigintVal.toLocaleString() : string
>stringVal : string
>bigintVal.toLocaleString() : string
>bigintVal.toLocaleString : () => string
>bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
>toLocaleString : () => string
>toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
stringVal = bigintVal.toLocaleString('de-DE');
>stringVal = bigintVal.toLocaleString('de-DE') : string
>stringVal : string
>bigintVal.toLocaleString('de-DE') : string
>bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
>toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
>'de-DE' : "de-DE"
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' });
>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string
>stringVal : string
>bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string
>bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
>toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
>'de-DE' : "de-DE"
>{ style: 'currency' } : { style: string; }
>style : string
>'currency' : "currency"
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' })
>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string
>stringVal : string
>bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string
>bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
>bigintVal : bigint
>toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string
>'de-DE' : "de-DE"
>{ style: 'currency', currency: 'EUR' } : { style: string; currency: string; }
>style : string
>'currency' : "currency"
>currency : string
>'EUR' : "EUR"
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
@@ -350,3 +385,26 @@ let z = 12n; // should emit type bigint in declaration file
>z : bigint
>12n : 12n
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
>new Intl.NumberFormat("fr").format(3000n) : string
>new Intl.NumberFormat("fr").format : { (value: number): string; (value: number | bigint): string; }
>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"
>format : { (value: number): string; (value: number | bigint): string; }
>3000n : 3000n
new Intl.NumberFormat("fr").format(bigintVal);
>new Intl.NumberFormat("fr").format(bigintVal) : string
>new Intl.NumberFormat("fr").format : { (value: number): string; (value: number | bigint): string; }
>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"
>format : { (value: number): string; (value: number | bigint): string; }
>bigintVal : bigint

View File

@@ -7,45 +7,51 @@ tests/cases/compiler/bigintWithoutLib.ts(8,13): error TS2304: Cannot find name '
tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(9,1): error TS2322: Type 'Object' is not assignable to type 'bigint'.
tests/cases/compiler/bigintWithoutLib.ts(11,32): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/bigintWithoutLib.ts(15,18): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(15,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(16,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(17,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(17,34): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(17,42): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(18,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(19,19): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(20,19): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(21,19): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(27,19): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(27,40): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(28,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(29,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(29,36): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(29,40): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(29,44): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(30,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(13,38): error TS2554: Expected 0 arguments, but got 1.
tests/cases/compiler/bigintWithoutLib.ts(14,38): error TS2554: Expected 0 arguments, but got 2.
tests/cases/compiler/bigintWithoutLib.ts(15,38): error TS2554: Expected 0 arguments, but got 2.
tests/cases/compiler/bigintWithoutLib.ts(18,18): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(18,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(19,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(20,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(20,34): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(20,38): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(20,42): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(21,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
tests/cases/compiler/bigintWithoutLib.ts(22,19): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(23,19): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(24,19): error TS2304: Cannot find name 'BigInt64Array'.
tests/cases/compiler/bigintWithoutLib.ts(30,19): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(30,40): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(31,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(32,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(32,36): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(32,40): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(32,44): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(33,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(40,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(40,26): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(41,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(41,26): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(42,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(43,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(34,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(35,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(36,20): error TS2304: Cannot find name 'BigUint64Array'.
tests/cases/compiler/bigintWithoutLib.ts(43,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(43,26): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(44,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(44,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(44,26): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(45,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(46,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(47,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(48,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(45,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(46,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(46,26): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(47,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(47,26): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(48,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(50,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(51,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(52,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
tests/cases/compiler/bigintWithoutLib.ts(55,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'.
tests/cases/compiler/bigintWithoutLib.ts(55,36): error TS2737: BigInt literals are not available when targeting lower than ES2020.
tests/cases/compiler/bigintWithoutLib.ts(56,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'.
==== tests/cases/compiler/bigintWithoutLib.ts (45 errors) ====
==== tests/cases/compiler/bigintWithoutLib.ts (51 errors) ====
// Every line should error because these builtins are not declared
// Test BigInt functions
@@ -76,6 +82,15 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
~
!!! error TS2554: Expected 0 arguments, but got 1.
stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {}
~~~~~~~
!!! error TS2554: Expected 0 arguments, but got 1.
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 0 arguments, but got 2.
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 0 arguments, but got 2.
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
@@ -83,15 +98,15 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
!!! error TS2304: Cannot find name 'BigInt64Array'.
~~~~~~~~~~~~~
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:15:5: 'bigIntArray' is declared here.
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:18:5: 'bigIntArray' is declared here.
bigIntArray = new BigInt64Array(10);
~~~~~~~~~~~~~
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:15:5: 'bigIntArray' is declared here.
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:18:5: 'bigIntArray' is declared here.
bigIntArray = new BigInt64Array([1n, 2n, 3n]);
~~~~~~~~~~~~~
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:15:5: 'bigIntArray' is declared here.
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:18:5: 'bigIntArray' is declared here.
~~
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
~~
@@ -101,7 +116,7 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
bigIntArray = new BigInt64Array([1, 2, 3]);
~~~~~~~~~~~~~
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:15:5: 'bigIntArray' is declared here.
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:18:5: 'bigIntArray' is declared here.
bigIntArray = new BigInt64Array(new ArrayBuffer(80));
~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'BigInt64Array'.
@@ -188,4 +203,15 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
!!! error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
bigintVal = dataView.getBigUint64(2, true);
~~~~~~~~~~~~
!!! error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
!!! error TS2339: Property 'getBigUint64' does not exist on type 'DataView'.
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
~~~~~
!!! error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'.
~~~~~
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
new Intl.NumberFormat("fr").format(bigintVal);
~~~~~~~~~
!!! error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'.

View File

@@ -11,6 +11,9 @@ bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {}
let stringVal: string = bigintVal.toString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {}
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
@@ -47,7 +50,12 @@ dataView.setBigUint64(2, 123);
bigintVal = dataView.getBigInt64(1);
bigintVal = dataView.getBigInt64(1, true);
bigintVal = dataView.getBigUint64(2);
bigintVal = dataView.getBigUint64(2, true);
bigintVal = dataView.getBigUint64(2, true);
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
new Intl.NumberFormat("fr").format(bigintVal);
//// [bigintWithoutLib.js]
// Every line should error because these builtins are not declared
@@ -61,6 +69,9 @@ bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {}
var stringVal = bigintVal.toString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }); // should not error - bigintVal inferred as {}
// Test BigInt64Array
var bigIntArray = new BigInt64Array();
bigIntArray = new BigInt64Array(10);
@@ -95,3 +106,6 @@ bigintVal = dataView.getBigInt64(1);
bigintVal = dataView.getBigInt64(1, true);
bigintVal = dataView.getBigUint64(2);
bigintVal = dataView.getBigUint64(2, true);
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
new Intl.NumberFormat("fr").format(bigintVal);

View File

@@ -39,116 +39,153 @@ stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --))
stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {}
>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3))
>bigintVal.toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --))
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {}
>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3))
>bigintVal.toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --))
>style : Symbol(style, Decl(bigintWithoutLib.ts, 13, 47))
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {}
>stringVal : Symbol(stringVal, Decl(bigintWithoutLib.ts, 9, 3))
>bigintVal.toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>toLocaleString : Symbol(Object.toLocaleString, Decl(lib.es5.d.ts, --, --))
>style : Symbol(style, Decl(bigintWithoutLib.ts, 14, 47))
>currency : Symbol(currency, Decl(bigintWithoutLib.ts, 14, 66))
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
bigIntArray = new BigInt64Array(10);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
bigIntArray = new BigInt64Array([1n, 2n, 3n]);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
bigIntArray = new BigInt64Array([1, 2, 3]);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
bigIntArray = new BigInt64Array(new ArrayBuffer(80));
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3);
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
let len: number = bigIntArray.length;
>len : Symbol(len, Decl(bigintWithoutLib.ts, 21, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>len : Symbol(len, Decl(bigintWithoutLib.ts, 24, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
bigIntArray.length = 10;
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
let arrayBufferLike: ArrayBufferView = bigIntArray;
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 23, 3))
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 26, 3))
>ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
// Test BigUint64Array
let bigUintArray: BigUint64Array = new BigUint64Array();
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3))
bigUintArray = new BigUint64Array(10);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3))
bigUintArray = new BigUint64Array([1n, 2n, 3n]);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3))
bigUintArray = new BigUint64Array([1, 2, 3]);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3))
bigUintArray = new BigUint64Array(new ArrayBuffer(80));
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3);
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3))
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
len = bigIntArray.length;
>len : Symbol(len, Decl(bigintWithoutLib.ts, 21, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>len : Symbol(len, Decl(bigintWithoutLib.ts, 24, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
bigIntArray.length = 10;
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
arrayBufferLike = bigIntArray;
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 23, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3))
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 26, 3))
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3))
// Test added DataView methods
const dataView = new DataView(new ArrayBuffer(80));
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
>DataView : Symbol(DataView, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
dataView.setBigInt64(1, -1n);
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
dataView.setBigInt64(1, -1n, true);
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
dataView.setBigInt64(1, -1);
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
dataView.setBigUint64(2, 123n);
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
dataView.setBigUint64(2, 123n, true);
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
dataView.setBigUint64(2, 123);
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
bigintVal = dataView.getBigInt64(1);
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
bigintVal = dataView.getBigInt64(1, true);
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
bigintVal = dataView.getBigUint64(2);
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
bigintVal = dataView.getBigUint64(2, true);
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5))
>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5))
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
>new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --))
>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --))
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --))
new Intl.NumberFormat("fr").format(bigintVal);
>new Intl.NumberFormat("fr").format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --))
>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --))
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>format : Symbol(Intl.NumberFormat.format, Decl(lib.es5.d.ts, --, --))
>bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3))

View File

@@ -72,6 +72,41 @@ stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred
>bigintVal : bigint
>toLocaleString : () => string
stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {}
>stringVal = bigintVal.toLocaleString('de-DE') : string
>stringVal : string
>bigintVal.toLocaleString('de-DE') : string
>bigintVal.toLocaleString : () => string
>bigintVal : bigint
>toLocaleString : () => string
>'de-DE' : "de-DE"
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {}
>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string
>stringVal : string
>bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string
>bigintVal.toLocaleString : () => string
>bigintVal : bigint
>toLocaleString : () => string
>'de-DE' : "de-DE"
>{ style: 'currency' } : { style: string; }
>style : string
>'currency' : "currency"
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {}
>stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string
>stringVal : string
>bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string
>bigintVal.toLocaleString : () => string
>bigintVal : bigint
>toLocaleString : () => string
>'de-DE' : "de-DE"
>{ style: 'currency', currency: 'EUR' } : { style: string; currency: string; }
>style : string
>'currency' : "currency"
>currency : string
>'EUR' : "EUR"
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
>bigIntArray : any
@@ -334,3 +369,26 @@ bigintVal = dataView.getBigUint64(2, true);
>2 : 2
>true : true
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
>new Intl.NumberFormat("fr").format(3000n) : string
>new Intl.NumberFormat("fr").format : (value: number) => string
>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"
>format : (value: number) => string
>3000n : 3000n
new Intl.NumberFormat("fr").format(bigintVal);
>new Intl.NumberFormat("fr").format(bigintVal) : string
>new Intl.NumberFormat("fr").format : (value: number) => string
>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"
>format : (value: number) => string
>bigintVal : bigint

View File

@@ -11,6 +11,9 @@ bigintVal = bigintVal.valueOf();
let stringVal: string = bigintVal.toString();
stringVal = bigintVal.toString(2);
stringVal = bigintVal.toLocaleString();
stringVal = bigintVal.toLocaleString('de-DE');
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' });
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' })
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
@@ -54,3 +57,7 @@ const w = 12n; // should emit as const w = 12n
const x = -12n; // should emit as const x = -12n
const y: 12n = 12n; // should emit type 12n
let z = 12n; // should emit type bigint in declaration file
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
new Intl.NumberFormat("fr").format(bigintVal);

View File

@@ -12,6 +12,9 @@ bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {}
let stringVal: string = bigintVal.toString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should not error - bigintVal inferred as {}
stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {}
// Test BigInt64Array
let bigIntArray: BigInt64Array = new BigInt64Array();
@@ -48,4 +51,8 @@ dataView.setBigUint64(2, 123);
bigintVal = dataView.getBigInt64(1);
bigintVal = dataView.getBigInt64(1, true);
bigintVal = dataView.getBigUint64(2);
bigintVal = dataView.getBigUint64(2, true);
bigintVal = dataView.getBigUint64(2, true);
// Test Intl methods with new parameter type
new Intl.NumberFormat("fr").format(3000n);
new Intl.NumberFormat("fr").format(bigintVal);