From 7d5942d555b6d99239cc807fb197ddd99e316602 Mon Sep 17 00:00:00 2001 From: Song Gao Date: Wed, 13 May 2020 10:42:55 +0800 Subject: [PATCH 01/10] update toLocalString function signature --- src/lib/es2020.bigint.d.ts | 102 ++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index d39759b81898b..93eddeca99e69 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -1,3 +1,103 @@ +type From1To21 = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21; +type From0To20 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20; + +interface BigIntToLocaleStringOptionsBase { + /** + * 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?: "lookup" | "best fit"; + /** + * The formatting style to use , the default is "decimal". + */ + style?: "decimal" | "percent"; + + numberingSystem?: "arab" | "arabext" | " bali" | "beng" | "deva" | "fullwide" | " gujr" | "guru" | "hanidec" | "khmr" | " knda" | "laoo" | "latn" | "limb" | "mlym" | " mong" | "mymr" | "orya" | "tamldec" | " telu" | "thai" | "tibt" + + /** + * 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?: "long" | "short" | "narrow"; + + /** + * 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. + */ + currency?: string; + /** + * How to display the currency in currency formatting. 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?: "symbol" | "code" | "name"; + + /** + * 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?: From1To21; + + /** + * 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?: From0To20; + + /** + * 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?: From0To20; + + /** + * The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1. + */ + minimumSignificantDigits?: From1To21; + /** + * The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21. + */ + maximumSignificantDigits?: From1To21; + + /** + * 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?: "standard" | "scientific" | "engineering" | "compact"; + + /** + * used only when notation is "compact" + */ + compactDisplay?: "short" | "long"; +} + +interface BigIntToLocaleStringOptionsStyleUnit extends Omit { + style: "unit"; + unit: string; +} + +interface BigIntToLocaleStringOptionsStyleCurrency extends Omit { + style: "currency"; + currency: string; +} + +type BigIntToLocaleStringOptions = BigIntToLocaleStringOptionsStyleUnit|BigIntToLocaleStringOptionsStyleCurrency|BigIntToLocaleStringOptionsBase; + interface BigInt { /** * Returns a string representation of an object. @@ -6,7 +106,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; From 2f468d943e91e97539debf73547b63d78892808e Mon Sep 17 00:00:00 2001 From: Song Gao Date: Wed, 13 May 2020 14:35:21 +0800 Subject: [PATCH 02/10] update test. --- src/lib/es2020.bigint.d.ts | 24 ++-- .../reference/bigintWithLib.errors.txt | 17 ++- tests/baselines/reference/bigintWithLib.js | 10 ++ .../baselines/reference/bigintWithLib.symbols | 112 ++++++++++++------ tests/baselines/reference/bigintWithLib.types | 60 +++++++++- .../reference/bigintWithoutLib.errors.txt | 100 +++++++++------- tests/baselines/reference/bigintWithoutLib.js | 10 ++ .../reference/bigintWithoutLib.symbols | 104 ++++++++++------ .../reference/bigintWithoutLib.types | 56 +++++++++ tests/cases/compiler/bigintWithLib.ts | 5 + tests/cases/compiler/bigintWithoutLib.ts | 5 + 11 files changed, 369 insertions(+), 134 deletions(-) diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index 93eddeca99e69..340df4c4a533b 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -5,13 +5,13 @@ interface BigIntToLocaleStringOptionsBase { /** * 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?: "lookup" | "best fit"; + localeMatcher?: "lookup" | "best fit" | string; /** * The formatting style to use , the default is "decimal". */ - style?: "decimal" | "percent"; + style?: "decimal" | "percent" | string; - numberingSystem?: "arab" | "arabext" | " bali" | "beng" | "deva" | "fullwide" | " gujr" | "guru" | "hanidec" | "khmr" | " knda" | "laoo" | "latn" | "limb" | "mlym" | " mong" | "mymr" | "orya" | "tamldec" | " telu" | "thai" | "tibt" + numberingSystem?: "arab" | "arabext" | " bali" | "beng" | "deva" | "fullwide" | " gujr" | "guru" | "hanidec" | "khmr" | " knda" | "laoo" | "latn" | "limb" | "mlym" | " mong" | "mymr" | "orya" | "tamldec" | " telu" | "thai" | "tibt" | 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. @@ -21,14 +21,14 @@ interface BigIntToLocaleStringOptionsBase { /** * The unit formatting style to use in unit formatting, the defaults is "short". */ - unitDisplay?: "long" | "short" | "narrow"; + unitDisplay?: "long" | "short" | "narrow" | 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. + * 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. The default is "symbol". + * 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 €, * @@ -36,7 +36,7 @@ interface BigIntToLocaleStringOptionsBase { * * "name" to use a localized currency name such as "dollar" */ - currencyDisplay?: "symbol" | "code" | "name"; + currencyDisplay?: "symbol" | "code" | "name" | string; /** * Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. The default is true. @@ -78,25 +78,25 @@ interface BigIntToLocaleStringOptionsBase { * * "compact" string representing exponent, defaults is using the "short" form */ - notation?: "standard" | "scientific" | "engineering" | "compact"; + notation?: "standard" | "scientific" | "engineering" | "compact" | string; /** * used only when notation is "compact" */ - compactDisplay?: "short" | "long"; + compactDisplay?: "short" | "long" | string; } -interface BigIntToLocaleStringOptionsStyleUnit extends Omit { +interface BigIntToLocaleStringOptionsStyleUnit extends Omit { style: "unit"; unit: string; } -interface BigIntToLocaleStringOptionsStyleCurrency extends Omit { +interface BigIntToLocaleStringOptionsStyleCurrency extends Omit { style: "currency"; currency: string; } -type BigIntToLocaleStringOptions = BigIntToLocaleStringOptionsStyleUnit|BigIntToLocaleStringOptionsStyleCurrency|BigIntToLocaleStringOptionsBase; +type BigIntToLocaleStringOptions = BigIntToLocaleStringOptionsStyleUnit | BigIntToLocaleStringOptionsStyleCurrency | BigIntToLocaleStringOptionsBase; interface BigInt { /** diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index 62b63d69bf324..c917c7a4899ee 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -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(21,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): 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: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error. Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. 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(26,13): error TS2540: Cannot assign to 'length' because it is a read-only property. +tests/cases/compiler/bigintWithLib.ts(33,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): 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: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error. Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'. 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 '-1' is not assignable to parameter of type 'bigint'. -tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'. +tests/cases/compiler/bigintWithLib.ts(38,13): error TS2540: Cannot assign to 'length' because it is a read-only property. +tests/cases/compiler/bigintWithLib.ts(45,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'. +tests/cases/compiler/bigintWithLib.ts(48,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'. ==== tests/cases/compiler/bigintWithLib.ts (7 errors) ==== @@ -39,6 +39,11 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12 let stringVal: string = bigintVal.toString(); stringVal = bigintVal.toString(2); stringVal = bigintVal.toLocaleString(); + stringVal = bigintVal.toLocaleString('de-DE'); + stringVal = bigintVal.toLocaleString('de-DE'); + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error + stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); diff --git a/tests/baselines/reference/bigintWithLib.js b/tests/baselines/reference/bigintWithLib.js index 13aeaa877e82b..e44bf866fbfe9 100644 --- a/tests/baselines/reference/bigintWithLib.js +++ b/tests/baselines/reference/bigintWithLib.js @@ -9,6 +9,11 @@ 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'); +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); @@ -65,6 +70,11 @@ bigintVal = bigintVal.valueOf(); let stringVal = bigintVal.toString(); stringVal = bigintVal.toString(2); stringVal = bigintVal.toLocaleString(); +stringVal = bigintVal.toLocaleString('de-DE'); +stringVal = bigintVal.toLocaleString('de-DE'); +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }); // Test BigInt64Array let bigIntArray = new BigInt64Array(); bigIntArray = new BigInt64Array(10); diff --git a/tests/baselines/reference/bigintWithLib.symbols b/tests/baselines/reference/bigintWithLib.symbols index dad221f75f4f1..61ad0956facaa 100644 --- a/tests/baselines/reference/bigintWithLib.symbols +++ b/tests/baselines/reference/bigintWithLib.symbols @@ -47,173 +47,207 @@ 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'); +>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' }); // should error +>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)) + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +>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, 13, 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, 14, 47)) +>currency : Symbol(currency, Decl(bigintWithLib.ts, 14, 66)) + // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 17, 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, 17, 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, 17, 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, 17, 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, 17, 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, 17, 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, 17, 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, 24, 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, 17, 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, 17, 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, 26, 3)) >ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 17, 3)) // Test BigUint64Array let bigUintArray: BigUint64Array = new BigUint64Array(); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 29, 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, 29, 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, 29, 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, 29, 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, 29, 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, 29, 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, 29, 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, 24, 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, 17, 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, 17, 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, 26, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 17, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 54, 5)) const x = -12n; // should emit as const x = -12n ->x : Symbol(x, Decl(bigintWithLib.ts, 50, 5)) +>x : Symbol(x, Decl(bigintWithLib.ts, 55, 5)) const y: 12n = 12n; // should emit type 12n ->y : Symbol(y, Decl(bigintWithLib.ts, 51, 5)) +>y : Symbol(y, Decl(bigintWithLib.ts, 56, 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, 57, 3)) diff --git a/tests/baselines/reference/bigintWithLib.types b/tests/baselines/reference/bigintWithLib.types index 6715dc70c3b2b..4a3cf3528e35d 100644 --- a/tests/baselines/reference/bigintWithLib.types +++ b/tests/baselines/reference/bigintWithLib.types @@ -66,9 +66,65 @@ 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'); +>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' }); // should error +>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: "currency"; } +>style : "currency" +>'currency' : "currency" + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +>stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string +>stringVal : string +>bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string +>bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string +>bigintVal : bigint +>toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string +>'de-DE' : "de-DE" +>{ style: 'unit' } : { style: "unit"; } +>style : "unit" +>'unit' : "unit" + +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: "currency"; currency: string; } +>style : "currency" +>'currency' : "currency" +>currency : string +>'EUR' : "EUR" // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib.errors.txt index 5d4aba77623de..978329a38f9d5 100644 --- a/tests/baselines/reference/bigintWithoutLib.errors.txt +++ b/tests/baselines/reference/bigintWithoutLib.errors.txt @@ -7,45 +7,50 @@ 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(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(13,38): error TS2554: Expected 0 arguments, but got 1. +tests/cases/compiler/bigintWithoutLib.ts(14,38): error TS2554: Expected 0 arguments, but got 1. +tests/cases/compiler/bigintWithoutLib.ts(15,38): error TS2554: Expected 0 arguments, but got 2. +tests/cases/compiler/bigintWithoutLib.ts(16,38): error TS2554: Expected 0 arguments, but got 2. +tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2554: Expected 0 arguments, but got 2. +tests/cases/compiler/bigintWithoutLib.ts(20,18): error TS2304: Cannot find name 'BigInt64Array'. +tests/cases/compiler/bigintWithoutLib.ts(20,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? +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 TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? +tests/cases/compiler/bigintWithoutLib.ts(22,34): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(22,38): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(22,42): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(23,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? +tests/cases/compiler/bigintWithoutLib.ts(24,19): error TS2304: Cannot find name 'BigInt64Array'. +tests/cases/compiler/bigintWithoutLib.ts(25,19): error TS2304: Cannot find name 'BigInt64Array'. +tests/cases/compiler/bigintWithoutLib.ts(26,19): error TS2304: Cannot find name 'BigInt64Array'. +tests/cases/compiler/bigintWithoutLib.ts(32,19): error TS2304: Cannot find name 'BigUint64Array'. +tests/cases/compiler/bigintWithoutLib.ts(32,40): error TS2304: Cannot find name 'BigUint64Array'. 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(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,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(34,20): error TS2304: Cannot find name 'BigUint64Array'. +tests/cases/compiler/bigintWithoutLib.ts(34,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(34,40): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(34,44): error TS2737: BigInt literals are not available when targeting lower than ES2020. +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(37,20): error TS2304: Cannot find name 'BigUint64Array'. +tests/cases/compiler/bigintWithoutLib.ts(38,20): error TS2304: Cannot find name 'BigUint64Array'. +tests/cases/compiler/bigintWithoutLib.ts(45,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(45,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(46,10): error TS2339: Property 'setBigInt64' 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 'setBigInt64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(48,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(48,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(49,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(49,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(50,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(51,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(52,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(53,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(54,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. -==== tests/cases/compiler/bigintWithoutLib.ts (45 errors) ==== +==== tests/cases/compiler/bigintWithoutLib.ts (50 errors) ==== // Every line should error because these builtins are not declared // Test BigInt functions @@ -76,6 +81,21 @@ 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'); + ~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 1. + stringVal = bigintVal.toLocaleString('de-DE'); + ~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 1. + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 2. + stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 2. + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 0 arguments, but got 2. // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); @@ -83,15 +103,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:20: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:20: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:20:5: 'bigIntArray' is declared here. ~~ !!! error TS2737: BigInt literals are not available when targeting lower than ES2020. ~~ @@ -101,7 +121,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:20:5: 'bigIntArray' is declared here. bigIntArray = new BigInt64Array(new ArrayBuffer(80)); ~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'BigInt64Array'. diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib.js index 31a59fcbaf03b..a621b65666818 100644 --- a/tests/baselines/reference/bigintWithoutLib.js +++ b/tests/baselines/reference/bigintWithoutLib.js @@ -11,6 +11,11 @@ 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'); +stringVal = bigintVal.toLocaleString('de-DE'); +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); @@ -61,6 +66,11 @@ 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'); +stringVal = bigintVal.toLocaleString('de-DE'); +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }); // Test BigInt64Array var bigIntArray = new BigInt64Array(); bigIntArray = new BigInt64Array(10); diff --git a/tests/baselines/reference/bigintWithoutLib.symbols b/tests/baselines/reference/bigintWithoutLib.symbols index 35e69305e18ba..9e604249a99d2 100644 --- a/tests/baselines/reference/bigintWithoutLib.symbols +++ b/tests/baselines/reference/bigintWithoutLib.symbols @@ -39,116 +39,150 @@ 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'); +>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'); +>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 error +>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)) + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +>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, 15, 47)) + +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) +>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, 16, 47)) +>currency : Symbol(currency, Decl(bigintWithoutLib.ts, 16, 66)) + // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) bigIntArray = new BigInt64Array(10); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) bigIntArray = new BigInt64Array([1n, 2n, 3n]); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) bigIntArray = new BigInt64Array([1, 2, 3]); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) bigIntArray = new BigInt64Array(new ArrayBuffer(80)); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 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, 19, 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, 19, 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, 26, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) bigIntArray.length = 10; ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) let arrayBufferLike: ArrayBufferView = bigIntArray; ->arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 23, 3)) +>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 28, 3)) >ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) // Test BigUint64Array let bigUintArray: BigUint64Array = new BigUint64Array(); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) bigUintArray = new BigUint64Array(10); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) bigUintArray = new BigUint64Array([1n, 2n, 3n]); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) bigUintArray = new BigUint64Array([1, 2, 3]); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) bigUintArray = new BigUint64Array(new ArrayBuffer(80)); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 26, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 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, 31, 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, 31, 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, 26, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) bigIntArray.length = 10; ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 14, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 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, 28, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 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, 43, 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, 43, 5)) dataView.setBigInt64(1, -1n, true); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) dataView.setBigInt64(1, -1); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) dataView.setBigUint64(2, 123n); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) dataView.setBigUint64(2, 123n, true); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) dataView.setBigUint64(2, 123); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 38, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 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, 43, 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, 43, 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, 43, 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, 43, 5)) diff --git a/tests/baselines/reference/bigintWithoutLib.types b/tests/baselines/reference/bigintWithoutLib.types index 24470aa45db6e..6b1469d60958f 100644 --- a/tests/baselines/reference/bigintWithoutLib.types +++ b/tests/baselines/reference/bigintWithoutLib.types @@ -72,6 +72,62 @@ stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred >bigintVal : bigint >toLocaleString : () => string +stringVal = bigintVal.toLocaleString('de-DE'); +>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'); +>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 error +>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: 'unit' }); // should error +>stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string +>stringVal : string +>bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string +>bigintVal.toLocaleString : () => string +>bigintVal : bigint +>toLocaleString : () => string +>'de-DE' : "de-DE" +>{ style: 'unit' } : { style: string; } +>style : string +>'unit' : "unit" + +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 : () => 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 diff --git a/tests/cases/compiler/bigintWithLib.ts b/tests/cases/compiler/bigintWithLib.ts index a23e22c3515ae..625df98e06073 100644 --- a/tests/cases/compiler/bigintWithLib.ts +++ b/tests/cases/compiler/bigintWithLib.ts @@ -11,6 +11,11 @@ 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'); +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); diff --git a/tests/cases/compiler/bigintWithoutLib.ts b/tests/cases/compiler/bigintWithoutLib.ts index 6ebb8630b7e82..0c878d8062090 100644 --- a/tests/cases/compiler/bigintWithoutLib.ts +++ b/tests/cases/compiler/bigintWithoutLib.ts @@ -12,6 +12,11 @@ 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'); +stringVal = bigintVal.toLocaleString('de-DE'); +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); From b11a746b2fe1735d635ea296a39d762fd6a9a68c Mon Sep 17 00:00:00 2001 From: Song Gao Date: Thu, 14 May 2020 10:58:08 +0800 Subject: [PATCH 03/10] fix lint --- src/lib/es2020.bigint.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index 340df4c4a533b..778b8c78357a3 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -70,11 +70,11 @@ interface BigIntToLocaleStringOptionsBase { /** * The formatting that should be displayed for the number, the defaults is "standard" * - * "standard" plain number formatting + * "standard" plain number formatting * - * "scientific" return the order-of-magnitude for formatted number. + * "scientific" return the order-of-magnitude for formatted number. * - * "engineering" return the exponent of ten when divisible by three + * "engineering" return the exponent of ten when divisible by three * * "compact" string representing exponent, defaults is using the "short" form */ From b1ad32c2c1bcdb482b14dbbc6dee471e7547a09c Mon Sep 17 00:00:00 2001 From: Song Gao Date: Fri, 22 May 2020 18:08:44 +0800 Subject: [PATCH 04/10] follow review advice. --- src/lib/es2020.bigint.d.ts | 23 +++++++++++-------- .../reference/bigintWithLib.errors.txt | 4 +++- tests/baselines/reference/bigintWithLib.js | 6 ++++- .../baselines/reference/bigintWithLib.symbols | 8 +++++++ tests/baselines/reference/bigintWithLib.types | 12 ++++++++++ .../reference/bigintWithoutLib.errors.txt | 13 +++++++++-- tests/baselines/reference/bigintWithoutLib.js | 7 +++++- .../reference/bigintWithoutLib.symbols | 8 +++++++ .../reference/bigintWithoutLib.types | 12 ++++++++++ tests/cases/compiler/bigintWithLib.ts | 3 +++ tests/cases/compiler/bigintWithoutLib.ts | 5 +++- 11 files changed, 85 insertions(+), 16 deletions(-) diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index 778b8c78357a3..bd550c63c86ca 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -1,6 +1,3 @@ -type From1To21 = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21; -type From0To20 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20; - interface BigIntToLocaleStringOptionsBase { /** * 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}. @@ -11,8 +8,7 @@ interface BigIntToLocaleStringOptionsBase { */ style?: "decimal" | "percent" | string; - numberingSystem?: "arab" | "arabext" | " bali" | "beng" | "deva" | "fullwide" | " gujr" | "guru" | "hanidec" | "khmr" | " knda" | "laoo" | "latn" | "limb" | "mlym" | " mong" | "mymr" | "orya" | "tamldec" | " telu" | "thai" | "tibt" | string; - + numberingSystem?: "arab" | "arabext" | "bali" | "beng" | "deva" | "fullwide" | "gujr" | "guru" | "hanidec" | "khmr" | "knda" | "laoo" | "latn" | "limb" | "mlym" | "mong" | "mymr" | "orya" | "tamldec" | "telu" | "thai" | "tibt" | 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. */ @@ -46,26 +42,26 @@ interface BigIntToLocaleStringOptionsBase { /** * The minimum number of integer digits to use. Possible values are from 1 to 21; the default is 1. */ - minimumIntegerDigits?: From1To21; + 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?: From0To20; + 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?: From0To20; + 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?: From1To21; + 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?: From1To21; + 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" @@ -713,3 +709,10 @@ interface DataView { */ setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void; } + +declare namespace Intl{ + interface NumberFormat { + format(value: number | bigint): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } +} \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index c917c7a4899ee..2bde098a86e79 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -118,4 +118,6 @@ tests/cases/compiler/bigintWithLib.ts(48,26): error TS2345: Argument of type '12 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 - \ No newline at end of file + + // Test added Intl methods + new Intl.NumberFormat("fr").format(3000n); \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithLib.js b/tests/baselines/reference/bigintWithLib.js index e44bf866fbfe9..f7eeac97ca64c 100644 --- a/tests/baselines/reference/bigintWithLib.js +++ b/tests/baselines/reference/bigintWithLib.js @@ -57,7 +57,9 @@ 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 added Intl methods +new Intl.NumberFormat("fr").format(3000n); //// [bigintWithLib.js] // Test BigInt functions @@ -114,6 +116,8 @@ 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 added Intl methods +new Intl.NumberFormat("fr").format(3000n); //// [bigintWithLib.d.ts] diff --git a/tests/baselines/reference/bigintWithLib.symbols b/tests/baselines/reference/bigintWithLib.symbols index 61ad0956facaa..45c8685dbea3c 100644 --- a/tests/baselines/reference/bigintWithLib.symbols +++ b/tests/baselines/reference/bigintWithLib.symbols @@ -251,3 +251,11 @@ const y: 12n = 12n; // should emit type 12n let z = 12n; // should emit type bigint in declaration file >z : Symbol(z, Decl(bigintWithLib.ts, 57, 3)) +// Test added Intl methods +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, --, --)) +>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, --, --)) + diff --git a/tests/baselines/reference/bigintWithLib.types b/tests/baselines/reference/bigintWithLib.types index 4a3cf3528e35d..ce05609de10ce 100644 --- a/tests/baselines/reference/bigintWithLib.types +++ b/tests/baselines/reference/bigintWithLib.types @@ -406,3 +406,15 @@ let z = 12n; // should emit type bigint in declaration file >z : bigint >12n : 12n +// Test added Intl methods +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 + diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib.errors.txt index 978329a38f9d5..1e450cde20046 100644 --- a/tests/baselines/reference/bigintWithoutLib.errors.txt +++ b/tests/baselines/reference/bigintWithoutLib.errors.txt @@ -48,9 +48,11 @@ tests/cases/compiler/bigintWithoutLib.ts(51,22): error TS2339: Property 'getBigI tests/cases/compiler/bigintWithoutLib.ts(52,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. tests/cases/compiler/bigintWithoutLib.ts(53,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. tests/cases/compiler/bigintWithoutLib.ts(54,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. +tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2345: Argument of type '3000n' is not assignable to parameter of type 'number'. +tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. -==== tests/cases/compiler/bigintWithoutLib.ts (50 errors) ==== +==== tests/cases/compiler/bigintWithoutLib.ts (52 errors) ==== // Every line should error because these builtins are not declared // Test BigInt functions @@ -208,4 +210,11 @@ tests/cases/compiler/bigintWithoutLib.ts(54,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'. \ No newline at end of file +!!! error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. + + // Test added Intl methods + new Intl.NumberFormat("fr").format(3000n); + ~~~~~ +!!! error TS2345: Argument of type '3000n' is not assignable to parameter of type 'number'. + ~~~~~ +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib.js index a621b65666818..30f0551dbf07e 100644 --- a/tests/baselines/reference/bigintWithoutLib.js +++ b/tests/baselines/reference/bigintWithoutLib.js @@ -52,7 +52,10 @@ 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 added Intl methods +new Intl.NumberFormat("fr").format(3000n); //// [bigintWithoutLib.js] // Every line should error because these builtins are not declared @@ -105,3 +108,5 @@ bigintVal = dataView.getBigInt64(1); bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); bigintVal = dataView.getBigUint64(2, true); +// Test added Intl methods +new Intl.NumberFormat("fr").format(3000n); diff --git a/tests/baselines/reference/bigintWithoutLib.symbols b/tests/baselines/reference/bigintWithoutLib.symbols index 9e604249a99d2..563e5eeb34b59 100644 --- a/tests/baselines/reference/bigintWithoutLib.symbols +++ b/tests/baselines/reference/bigintWithoutLib.symbols @@ -186,3 +186,11 @@ bigintVal = dataView.getBigUint64(2, true); >bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) >dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) +// Test added Intl methods +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, --, --)) + diff --git a/tests/baselines/reference/bigintWithoutLib.types b/tests/baselines/reference/bigintWithoutLib.types index 6b1469d60958f..9b427ae9023b8 100644 --- a/tests/baselines/reference/bigintWithoutLib.types +++ b/tests/baselines/reference/bigintWithoutLib.types @@ -390,3 +390,15 @@ bigintVal = dataView.getBigUint64(2, true); >2 : 2 >true : true +// Test added Intl methods +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 + diff --git a/tests/cases/compiler/bigintWithLib.ts b/tests/cases/compiler/bigintWithLib.ts index 625df98e06073..f4fee34d02a8b 100644 --- a/tests/cases/compiler/bigintWithLib.ts +++ b/tests/cases/compiler/bigintWithLib.ts @@ -59,3 +59,6 @@ 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 added Intl methods +new Intl.NumberFormat("fr").format(3000n); \ No newline at end of file diff --git a/tests/cases/compiler/bigintWithoutLib.ts b/tests/cases/compiler/bigintWithoutLib.ts index 0c878d8062090..f0a714c129cfa 100644 --- a/tests/cases/compiler/bigintWithoutLib.ts +++ b/tests/cases/compiler/bigintWithoutLib.ts @@ -53,4 +53,7 @@ dataView.setBigUint64(2, 123); bigintVal = dataView.getBigInt64(1); bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); -bigintVal = dataView.getBigUint64(2, true); \ No newline at end of file +bigintVal = dataView.getBigUint64(2, true); + +// Test added Intl methods +new Intl.NumberFormat("fr").format(3000n); \ No newline at end of file From 5592f60665eca1abf2bab0ba5ac34b2dea16d2b1 Mon Sep 17 00:00:00 2001 From: Song Gao Date: Fri, 22 May 2020 18:33:42 +0800 Subject: [PATCH 05/10] format and better comment. --- tests/baselines/reference/bigintWithLib.errors.txt | 5 +++-- tests/baselines/reference/bigintWithLib.js | 7 ++++--- tests/baselines/reference/bigintWithLib.symbols | 2 +- tests/baselines/reference/bigintWithLib.types | 2 +- tests/baselines/reference/bigintWithoutLib.errors.txt | 5 +++-- tests/baselines/reference/bigintWithoutLib.js | 7 ++++--- tests/baselines/reference/bigintWithoutLib.symbols | 2 +- tests/baselines/reference/bigintWithoutLib.types | 2 +- tests/cases/compiler/bigintWithLib.ts | 4 ++-- tests/cases/compiler/bigintWithoutLib.ts | 4 ++-- 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index 2bde098a86e79..eae97127e55c3 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -119,5 +119,6 @@ tests/cases/compiler/bigintWithLib.ts(48,26): error TS2345: Argument of type '12 const y: 12n = 12n; // should emit type 12n let z = 12n; // should emit type bigint in declaration file - // Test added Intl methods - new Intl.NumberFormat("fr").format(3000n); \ No newline at end of file + // Test Intl methods with new parameter type + new Intl.NumberFormat("fr").format(3000n); + \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithLib.js b/tests/baselines/reference/bigintWithLib.js index f7eeac97ca64c..b7471568843a2 100644 --- a/tests/baselines/reference/bigintWithLib.js +++ b/tests/baselines/reference/bigintWithLib.js @@ -58,8 +58,9 @@ 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 added Intl methods -new Intl.NumberFormat("fr").format(3000n); +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); + //// [bigintWithLib.js] // Test BigInt functions @@ -116,7 +117,7 @@ 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 added Intl methods +// Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); diff --git a/tests/baselines/reference/bigintWithLib.symbols b/tests/baselines/reference/bigintWithLib.symbols index 45c8685dbea3c..d10d36856bcc8 100644 --- a/tests/baselines/reference/bigintWithLib.symbols +++ b/tests/baselines/reference/bigintWithLib.symbols @@ -251,7 +251,7 @@ const y: 12n = 12n; // should emit type 12n let z = 12n; // should emit type bigint in declaration file >z : Symbol(z, Decl(bigintWithLib.ts, 57, 3)) -// Test added Intl methods +// 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, --, --)) diff --git a/tests/baselines/reference/bigintWithLib.types b/tests/baselines/reference/bigintWithLib.types index ce05609de10ce..7e7f916719e75 100644 --- a/tests/baselines/reference/bigintWithLib.types +++ b/tests/baselines/reference/bigintWithLib.types @@ -406,7 +406,7 @@ let z = 12n; // should emit type bigint in declaration file >z : bigint >12n : 12n -// Test added Intl methods +// 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; } diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib.errors.txt index 1e450cde20046..1c656ccae824f 100644 --- a/tests/baselines/reference/bigintWithoutLib.errors.txt +++ b/tests/baselines/reference/bigintWithoutLib.errors.txt @@ -212,9 +212,10 @@ tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2737: BigInt literals a ~~~~~~~~~~~~ !!! error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. - // Test added Intl methods + // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); ~~~~~ !!! error TS2345: Argument of type '3000n' is not assignable to parameter of type 'number'. ~~~~~ -!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. \ No newline at end of file +!!! error TS2737: BigInt literals are not available when targeting lower than ES2020. + \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib.js index 30f0551dbf07e..f7f7a48e52833 100644 --- a/tests/baselines/reference/bigintWithoutLib.js +++ b/tests/baselines/reference/bigintWithoutLib.js @@ -54,8 +54,9 @@ bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); bigintVal = dataView.getBigUint64(2, true); -// Test added Intl methods -new Intl.NumberFormat("fr").format(3000n); +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); + //// [bigintWithoutLib.js] // Every line should error because these builtins are not declared @@ -108,5 +109,5 @@ bigintVal = dataView.getBigInt64(1); bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); bigintVal = dataView.getBigUint64(2, true); -// Test added Intl methods +// Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); diff --git a/tests/baselines/reference/bigintWithoutLib.symbols b/tests/baselines/reference/bigintWithoutLib.symbols index 563e5eeb34b59..e9f2e207bbff8 100644 --- a/tests/baselines/reference/bigintWithoutLib.symbols +++ b/tests/baselines/reference/bigintWithoutLib.symbols @@ -186,7 +186,7 @@ bigintVal = dataView.getBigUint64(2, true); >bigintVal : Symbol(bigintVal, Decl(bigintWithoutLib.ts, 3, 3)) >dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) -// Test added Intl methods +// 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, --, --)) diff --git a/tests/baselines/reference/bigintWithoutLib.types b/tests/baselines/reference/bigintWithoutLib.types index 9b427ae9023b8..08f80a89d0188 100644 --- a/tests/baselines/reference/bigintWithoutLib.types +++ b/tests/baselines/reference/bigintWithoutLib.types @@ -390,7 +390,7 @@ bigintVal = dataView.getBigUint64(2, true); >2 : 2 >true : true -// Test added Intl methods +// 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 diff --git a/tests/cases/compiler/bigintWithLib.ts b/tests/cases/compiler/bigintWithLib.ts index f4fee34d02a8b..4842cfbadcf85 100644 --- a/tests/cases/compiler/bigintWithLib.ts +++ b/tests/cases/compiler/bigintWithLib.ts @@ -60,5 +60,5 @@ 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 added Intl methods -new Intl.NumberFormat("fr").format(3000n); \ No newline at end of file +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); diff --git a/tests/cases/compiler/bigintWithoutLib.ts b/tests/cases/compiler/bigintWithoutLib.ts index f0a714c129cfa..0d41eb461c8b0 100644 --- a/tests/cases/compiler/bigintWithoutLib.ts +++ b/tests/cases/compiler/bigintWithoutLib.ts @@ -55,5 +55,5 @@ bigintVal = dataView.getBigInt64(1, true); bigintVal = dataView.getBigUint64(2); bigintVal = dataView.getBigUint64(2, true); -// Test added Intl methods -new Intl.NumberFormat("fr").format(3000n); \ No newline at end of file +// Test Intl methods with new parameter type +new Intl.NumberFormat("fr").format(3000n); From af547be3d8d8ca6c8212807d167b04828a1a2222 Mon Sep 17 00:00:00 2001 From: Song Gao Date: Mon, 25 May 2020 10:56:58 +0800 Subject: [PATCH 06/10] format --- src/lib/es2020.bigint.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index bd550c63c86ca..eb90f4729cb1b 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -715,4 +715,4 @@ declare namespace Intl{ format(value: number | bigint): string; resolvedOptions(): ResolvedNumberFormatOptions; } -} \ No newline at end of file +} From f959c5f6e9c26bca8f2dca4b1960326c46342a5c Mon Sep 17 00:00:00 2001 From: Song Gao Date: Mon, 25 May 2020 11:52:01 +0800 Subject: [PATCH 07/10] add case --- tests/baselines/reference/bigintWithLib.errors.txt | 1 + tests/baselines/reference/bigintWithLib.js | 2 ++ tests/baselines/reference/bigintWithLib.symbols | 8 ++++++++ tests/baselines/reference/bigintWithLib.types | 11 +++++++++++ tests/baselines/reference/bigintWithoutLib.errors.txt | 6 +++++- tests/baselines/reference/bigintWithoutLib.js | 2 ++ tests/baselines/reference/bigintWithoutLib.symbols | 8 ++++++++ tests/baselines/reference/bigintWithoutLib.types | 11 +++++++++++ tests/cases/compiler/bigintWithLib.ts | 1 + tests/cases/compiler/bigintWithoutLib.ts | 1 + 10 files changed, 50 insertions(+), 1 deletion(-) diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index eae97127e55c3..4dcdff2c9d779 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -121,4 +121,5 @@ tests/cases/compiler/bigintWithLib.ts(48,26): error TS2345: Argument of type '12 // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); + new Intl.NumberFormat("fr").format(bigintVal); \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithLib.js b/tests/baselines/reference/bigintWithLib.js index b7471568843a2..2083b1c411e0f 100644 --- a/tests/baselines/reference/bigintWithLib.js +++ b/tests/baselines/reference/bigintWithLib.js @@ -60,6 +60,7 @@ 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] @@ -119,6 +120,7 @@ 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] diff --git a/tests/baselines/reference/bigintWithLib.symbols b/tests/baselines/reference/bigintWithLib.symbols index d10d36856bcc8..949916d50e4e5 100644 --- a/tests/baselines/reference/bigintWithLib.symbols +++ b/tests/baselines/reference/bigintWithLib.symbols @@ -259,3 +259,11 @@ new Intl.NumberFormat("fr").format(3000n); >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, --, --)) +>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)) + diff --git a/tests/baselines/reference/bigintWithLib.types b/tests/baselines/reference/bigintWithLib.types index 7e7f916719e75..e5824f04f234e 100644 --- a/tests/baselines/reference/bigintWithLib.types +++ b/tests/baselines/reference/bigintWithLib.types @@ -418,3 +418,14 @@ new Intl.NumberFormat("fr").format(3000n); >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 + diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib.errors.txt index 1c656ccae824f..c982944057a0e 100644 --- a/tests/baselines/reference/bigintWithoutLib.errors.txt +++ b/tests/baselines/reference/bigintWithoutLib.errors.txt @@ -50,9 +50,10 @@ tests/cases/compiler/bigintWithoutLib.ts(53,22): error TS2339: Property 'getBigU tests/cases/compiler/bigintWithoutLib.ts(54,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2345: Argument of type '3000n' is not assignable to parameter of type 'number'. tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. +tests/cases/compiler/bigintWithoutLib.ts(58,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. -==== tests/cases/compiler/bigintWithoutLib.ts (52 errors) ==== +==== tests/cases/compiler/bigintWithoutLib.ts (53 errors) ==== // Every line should error because these builtins are not declared // Test BigInt functions @@ -218,4 +219,7 @@ tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2737: BigInt literals a !!! error TS2345: Argument of type '3000n' 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'. \ No newline at end of file diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib.js index f7f7a48e52833..d6e4332507c0f 100644 --- a/tests/baselines/reference/bigintWithoutLib.js +++ b/tests/baselines/reference/bigintWithoutLib.js @@ -56,6 +56,7 @@ 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] @@ -111,3 +112,4 @@ 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); diff --git a/tests/baselines/reference/bigintWithoutLib.symbols b/tests/baselines/reference/bigintWithoutLib.symbols index e9f2e207bbff8..ebc6b0384429b 100644 --- a/tests/baselines/reference/bigintWithoutLib.symbols +++ b/tests/baselines/reference/bigintWithoutLib.symbols @@ -194,3 +194,11 @@ new Intl.NumberFormat("fr").format(3000n); >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)) + diff --git a/tests/baselines/reference/bigintWithoutLib.types b/tests/baselines/reference/bigintWithoutLib.types index 08f80a89d0188..9ba0ccf1c6142 100644 --- a/tests/baselines/reference/bigintWithoutLib.types +++ b/tests/baselines/reference/bigintWithoutLib.types @@ -402,3 +402,14 @@ new Intl.NumberFormat("fr").format(3000n); >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 + diff --git a/tests/cases/compiler/bigintWithLib.ts b/tests/cases/compiler/bigintWithLib.ts index 4842cfbadcf85..eec2f027f5c14 100644 --- a/tests/cases/compiler/bigintWithLib.ts +++ b/tests/cases/compiler/bigintWithLib.ts @@ -62,3 +62,4 @@ 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); diff --git a/tests/cases/compiler/bigintWithoutLib.ts b/tests/cases/compiler/bigintWithoutLib.ts index 0d41eb461c8b0..516a1a394171e 100644 --- a/tests/cases/compiler/bigintWithoutLib.ts +++ b/tests/cases/compiler/bigintWithoutLib.ts @@ -57,3 +57,4 @@ bigintVal = dataView.getBigUint64(2, true); // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); +new Intl.NumberFormat("fr").format(bigintVal); From bd99f0ab0ab54d3d37695019b822c6febcc1194e Mon Sep 17 00:00:00 2001 From: Song Gao Date: Mon, 25 May 2020 13:15:54 +0800 Subject: [PATCH 08/10] fix symbol. --- tests/baselines/reference/bigintWithLib.symbols | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/bigintWithLib.symbols b/tests/baselines/reference/bigintWithLib.symbols index 949916d50e4e5..2dd6bc3b57d2c 100644 --- a/tests/baselines/reference/bigintWithLib.symbols +++ b/tests/baselines/reference/bigintWithLib.symbols @@ -255,14 +255,14 @@ let z = 12n; // should emit type bigint in declaration file 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, --, --)) +>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, --, --)) +>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)) From abf01a3c15a76d604b406c090ed96c9da01cd1d5 Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Fri, 19 Jun 2020 14:41:26 +0800 Subject: [PATCH 09/10] remove subtype and string union in interface. --- src/lib/es2020.bigint.d.ts | 30 +++++++------------ .../reference/bigintWithLib.errors.txt | 6 ++-- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/lib/es2020.bigint.d.ts b/src/lib/es2020.bigint.d.ts index 34514bda98f28..15c92f072fca5 100644 --- a/src/lib/es2020.bigint.d.ts +++ b/src/lib/es2020.bigint.d.ts @@ -1,14 +1,14 @@ -interface BigIntToLocaleStringOptionsBase { +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?: "lookup" | "best fit" | string; + localeMatcher?: string; /** * The formatting style to use , the default is "decimal". */ - style?: "decimal" | "percent" | string; + style?: string; - numberingSystem?: "arab" | "arabext" | "bali" | "beng" | "deva" | "fullwide" | "gujr" | "guru" | "hanidec" | "khmr" | "knda" | "laoo" | "latn" | "limb" | "mlym" | "mong" | "mymr" | "orya" | "tamldec" | "telu" | "thai" | "tibt" | 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. */ @@ -17,12 +17,13 @@ interface BigIntToLocaleStringOptionsBase { /** * The unit formatting style to use in unit formatting, the defaults is "short". */ - unitDisplay?: "long" | "short" | "narrow" | string; + 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". * @@ -32,7 +33,7 @@ interface BigIntToLocaleStringOptionsBase { * * "name" to use a localized currency name such as "dollar" */ - currencyDisplay?: "symbol" | "code" | "name" | string; + currencyDisplay?: string; /** * Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. The default is true. @@ -58,6 +59,7 @@ interface BigIntToLocaleStringOptionsBase { * 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. */ @@ -74,26 +76,14 @@ interface BigIntToLocaleStringOptionsBase { * * "compact" string representing exponent, defaults is using the "short" form */ - notation?: "standard" | "scientific" | "engineering" | "compact" | string; + notation?: string; /** * used only when notation is "compact" */ - compactDisplay?: "short" | "long" | string; -} - -interface BigIntToLocaleStringOptionsStyleUnit extends Omit { - style: "unit"; - unit: string; + compactDisplay?: string; } -interface BigIntToLocaleStringOptionsStyleCurrency extends Omit { - style: "currency"; - currency: string; -} - -type BigIntToLocaleStringOptions = BigIntToLocaleStringOptionsStyleUnit | BigIntToLocaleStringOptionsStyleCurrency | BigIntToLocaleStringOptionsBase; - interface BigInt { /** * Returns a string representation of an object. diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index 1f324f42ae366..e9815741efd06 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -21,9 +21,9 @@ tests/cases/compiler/bigintWithLib.ts(33,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(38,13): error TS2540: Cannot assign to 'length' because it is a read-only property. +tests/cases/compiler/bigintWithLib.ts(45,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. +tests/cases/compiler/bigintWithLib.ts(48,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. ==== tests/cases/compiler/bigintWithLib.ts (7 errors) ==== From 1b3f4f572f7adef9c207797999cca8a187459abd Mon Sep 17 00:00:00 2001 From: ShuiRuTian <158983297@qq.com> Date: Mon, 22 Jun 2020 11:04:10 +0800 Subject: [PATCH 10/10] remove useless code. --- .../reference/bigintWithLib.errors.txt | 16 ++- tests/baselines/reference/bigintWithLib.js | 8 +- .../baselines/reference/bigintWithLib.symbols | 99 ++++++++----------- tests/baselines/reference/bigintWithLib.types | 31 +----- .../reference/bigintWithoutLib.errors.txt | 88 ++++++++--------- tests/baselines/reference/bigintWithoutLib.js | 16 ++- .../reference/bigintWithoutLib.symbols | 93 ++++++++--------- .../reference/bigintWithoutLib.types | 27 +---- tests/cases/compiler/bigintWithLib.ts | 4 +- tests/cases/compiler/bigintWithoutLib.ts | 8 +- 10 files changed, 150 insertions(+), 240 deletions(-) diff --git a/tests/baselines/reference/bigintWithLib.errors.txt b/tests/baselines/reference/bigintWithLib.errors.txt index e9815741efd06..006847c4824b1 100644 --- a/tests/baselines/reference/bigintWithLib.errors.txt +++ b/tests/baselines/reference/bigintWithLib.errors.txt @@ -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(21,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): BigInt64Array', gave the following error. @@ -12,8 +12,8 @@ tests/cases/compiler/bigintWithLib.ts(21,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(26,13): error TS2540: Cannot assign to 'length' because it is a read-only property. -tests/cases/compiler/bigintWithLib.ts(33,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): BigUint64Array', gave the following error. @@ -21,9 +21,9 @@ tests/cases/compiler/bigintWithLib.ts(33,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(38,13): error TS2540: Cannot assign to 'length' because it is a read-only property. -tests/cases/compiler/bigintWithLib.ts(45,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'bigint'. -tests/cases/compiler/bigintWithLib.ts(48,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) ==== @@ -40,9 +40,7 @@ tests/cases/compiler/bigintWithLib.ts(48,26): error TS2345: Argument of type 'nu stringVal = bigintVal.toString(2); stringVal = bigintVal.toLocaleString(); stringVal = bigintVal.toLocaleString('de-DE'); - stringVal = bigintVal.toLocaleString('de-DE'); - stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error - stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array diff --git a/tests/baselines/reference/bigintWithLib.js b/tests/baselines/reference/bigintWithLib.js index 2083b1c411e0f..c76a0775725d1 100644 --- a/tests/baselines/reference/bigintWithLib.js +++ b/tests/baselines/reference/bigintWithLib.js @@ -10,9 +10,7 @@ let stringVal: string = bigintVal.toString(); stringVal = bigintVal.toString(2); stringVal = bigintVal.toLocaleString(); stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array @@ -75,9 +73,7 @@ let stringVal = bigintVal.toString(); stringVal = bigintVal.toString(2); stringVal = bigintVal.toLocaleString(); stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }); // Test BigInt64Array let bigIntArray = new BigInt64Array(); diff --git a/tests/baselines/reference/bigintWithLib.symbols b/tests/baselines/reference/bigintWithLib.symbols index 2dd6bc3b57d2c..f8f7c6bb8812d 100644 --- a/tests/baselines/reference/bigintWithLib.symbols +++ b/tests/baselines/reference/bigintWithLib.symbols @@ -53,203 +53,190 @@ stringVal = bigintVal.toLocaleString('de-DE'); >bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3)) >toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --)) -stringVal = bigintVal.toLocaleString('de-DE'); +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, --, --)) - -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error ->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)) - -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error ->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, 13, 47)) +>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, 14, 47)) ->currency : Symbol(currency, Decl(bigintWithLib.ts, 14, 66)) +>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, 17, 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, 17, 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, 17, 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, 17, 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, 17, 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, 17, 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, 17, 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, 24, 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, 17, 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, 17, 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, 26, 3)) +>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithLib.ts, 24, 3)) >ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 17, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 15, 3)) // Test BigUint64Array let bigUintArray: BigUint64Array = new BigUint64Array(); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 29, 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, 29, 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, 29, 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, 29, 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, 29, 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, 29, 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, 29, 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, 24, 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, 17, 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, 17, 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, 26, 3)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 17, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 41, 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, 54, 5)) +>w : Symbol(w, Decl(bigintWithLib.ts, 52, 5)) const x = -12n; // should emit as const x = -12n ->x : Symbol(x, Decl(bigintWithLib.ts, 55, 5)) +>x : Symbol(x, Decl(bigintWithLib.ts, 53, 5)) const y: 12n = 12n; // should emit type 12n ->y : Symbol(y, Decl(bigintWithLib.ts, 56, 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, 57, 3)) +>z : Symbol(z, Decl(bigintWithLib.ts, 55, 3)) // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); diff --git a/tests/baselines/reference/bigintWithLib.types b/tests/baselines/reference/bigintWithLib.types index e5824f04f234e..802aa7c0b5500 100644 --- a/tests/baselines/reference/bigintWithLib.types +++ b/tests/baselines/reference/bigintWithLib.types @@ -79,16 +79,7 @@ stringVal = bigintVal.toLocaleString('de-DE'); >toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string >'de-DE' : "de-DE" -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' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); >stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string >stringVal : string >bigintVal.toLocaleString('de-DE', { style: 'currency' }) : string @@ -96,22 +87,10 @@ stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should >bigintVal : bigint >toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string >'de-DE' : "de-DE" ->{ style: 'currency' } : { style: "currency"; } ->style : "currency" +>{ style: 'currency' } : { style: string; } +>style : string >'currency' : "currency" -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error ->stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string ->stringVal : string ->bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string ->bigintVal.toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string ->bigintVal : bigint ->toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string ->'de-DE' : "de-DE" ->{ style: 'unit' } : { style: "unit"; } ->style : "unit" ->'unit' : "unit" - stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) >stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) : string >stringVal : string @@ -120,8 +99,8 @@ stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EU >bigintVal : bigint >toLocaleString : (locales?: string, options?: BigIntToLocaleStringOptions) => string >'de-DE' : "de-DE" ->{ style: 'currency', currency: 'EUR' } : { style: "currency"; currency: string; } ->style : "currency" +>{ style: 'currency', currency: 'EUR' } : { style: string; currency: string; } +>style : string >'currency' : "currency" >currency : string >'EUR' : "EUR" diff --git a/tests/baselines/reference/bigintWithoutLib.errors.txt b/tests/baselines/reference/bigintWithoutLib.errors.txt index c982944057a0e..ac4d7a5c2bf51 100644 --- a/tests/baselines/reference/bigintWithoutLib.errors.txt +++ b/tests/baselines/reference/bigintWithoutLib.errors.txt @@ -8,52 +8,50 @@ tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals ar 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(13,38): error TS2554: Expected 0 arguments, but got 1. -tests/cases/compiler/bigintWithoutLib.ts(14,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(16,38): error TS2554: Expected 0 arguments, but got 2. -tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2554: Expected 0 arguments, but got 2. -tests/cases/compiler/bigintWithoutLib.ts(20,18): error TS2304: Cannot find name 'BigInt64Array'. -tests/cases/compiler/bigintWithoutLib.ts(20,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? +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 TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? -tests/cases/compiler/bigintWithoutLib.ts(22,34): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(22,38): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(22,42): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(23,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(25,19): error TS2304: Cannot find name 'BigInt64Array'. -tests/cases/compiler/bigintWithoutLib.ts(26,19): error TS2304: Cannot find name 'BigInt64Array'. -tests/cases/compiler/bigintWithoutLib.ts(32,19): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(32,40): error TS2304: Cannot find name 'BigUint64Array'. +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(34,20): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(34,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(34,40): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(34,44): error TS2737: BigInt literals are not available when targeting lower than ES2020. 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(37,20): error TS2304: Cannot find name 'BigUint64Array'. -tests/cases/compiler/bigintWithoutLib.ts(38,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 '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 'setBigInt64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(45,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(46,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 'setBigInt64' does not exist on type 'DataView'. +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(48,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(49,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(49,26): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(50,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(51,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(52,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(53,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(54,22): error TS2339: Property 'getBigUint64' does not exist on type 'DataView'. -tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2345: Argument of type '3000n' is not assignable to parameter of type 'number'. -tests/cases/compiler/bigintWithoutLib.ts(57,36): error TS2737: BigInt literals are not available when targeting lower than ES2020. -tests/cases/compiler/bigintWithoutLib.ts(58,36): error TS2345: Argument of type 'bigint' is not assignable to parameter of type 'number'. +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 (53 errors) ==== +==== tests/cases/compiler/bigintWithoutLib.ts (51 errors) ==== // Every line should error because these builtins are not declared // Test BigInt functions @@ -84,19 +82,13 @@ tests/cases/compiler/bigintWithoutLib.ts(58,36): error TS2345: Argument of type ~ !!! error TS2554: Expected 0 arguments, but got 1. stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred as {} - stringVal = bigintVal.toLocaleString('de-DE'); + stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {} ~~~~~~~ !!! error TS2554: Expected 0 arguments, but got 1. - stringVal = bigintVal.toLocaleString('de-DE'); - ~~~~~~~ -!!! error TS2554: Expected 0 arguments, but got 1. - stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error + 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: 'unit' }); // should error - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2554: Expected 0 arguments, but got 2. - stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) + stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // should not error - bigintVal inferred as {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 0 arguments, but got 2. @@ -106,15 +98,15 @@ tests/cases/compiler/bigintWithoutLib.ts(58,36): error TS2345: Argument of type !!! error TS2304: Cannot find name 'BigInt64Array'. ~~~~~~~~~~~~~ !!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? -!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:20: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:20: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:20: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. ~~ @@ -124,7 +116,7 @@ tests/cases/compiler/bigintWithoutLib.ts(58,36): error TS2345: Argument of type bigIntArray = new BigInt64Array([1, 2, 3]); ~~~~~~~~~~~~~ !!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'? -!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:20: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'. @@ -216,7 +208,7 @@ tests/cases/compiler/bigintWithoutLib.ts(58,36): error TS2345: Argument of type // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); ~~~~~ -!!! error TS2345: Argument of type '3000n' is not assignable to parameter of type 'number'. +!!! 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); diff --git a/tests/baselines/reference/bigintWithoutLib.js b/tests/baselines/reference/bigintWithoutLib.js index d6e4332507c0f..2dd67284e033d 100644 --- a/tests/baselines/reference/bigintWithoutLib.js +++ b/tests/baselines/reference/bigintWithoutLib.js @@ -11,11 +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'); -stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) +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(); @@ -71,11 +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'); -stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }); +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); diff --git a/tests/baselines/reference/bigintWithoutLib.symbols b/tests/baselines/reference/bigintWithoutLib.symbols index ebc6b0384429b..658c2bd95896d 100644 --- a/tests/baselines/reference/bigintWithoutLib.symbols +++ b/tests/baselines/reference/bigintWithoutLib.symbols @@ -39,152 +39,139 @@ 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'); +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'); +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' }); // should error +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)) - -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error ->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, 15, 47)) - -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) ->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, 16, 47)) ->currency : Symbol(currency, Decl(bigintWithoutLib.ts, 16, 66)) +>currency : Symbol(currency, Decl(bigintWithoutLib.ts, 14, 66)) // Test BigInt64Array let bigIntArray: BigInt64Array = new BigInt64Array(); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) bigIntArray = new BigInt64Array(10); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) bigIntArray = new BigInt64Array([1n, 2n, 3n]); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) bigIntArray = new BigInt64Array([1, 2, 3]); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) bigIntArray = new BigInt64Array(new ArrayBuffer(80)); ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 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, 19, 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, 19, 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, 26, 3)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 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, 19, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) let arrayBufferLike: ArrayBufferView = bigIntArray; ->arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 28, 3)) +>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 26, 3)) >ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) // Test BigUint64Array let bigUintArray: BigUint64Array = new BigUint64Array(); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) bigUintArray = new BigUint64Array(10); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) bigUintArray = new BigUint64Array([1n, 2n, 3n]); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) bigUintArray = new BigUint64Array([1, 2, 3]); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 3)) +>bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 29, 3)) bigUintArray = new BigUint64Array(new ArrayBuffer(80)); ->bigUintArray : Symbol(bigUintArray, Decl(bigintWithoutLib.ts, 31, 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, 31, 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, 31, 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, 26, 3)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 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, 19, 3)) +>bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 17, 3)) arrayBufferLike = bigIntArray; ->arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithoutLib.ts, 28, 3)) ->bigIntArray : Symbol(bigIntArray, Decl(bigintWithoutLib.ts, 19, 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, 43, 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, 43, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) dataView.setBigInt64(1, -1n, true); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) dataView.setBigInt64(1, -1); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) dataView.setBigUint64(2, 123n); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) dataView.setBigUint64(2, 123n, true); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) dataView.setBigUint64(2, 123); ->dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 43, 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, 43, 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, 43, 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, 43, 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, 43, 5)) +>dataView : Symbol(dataView, Decl(bigintWithoutLib.ts, 41, 5)) // Test Intl methods with new parameter type new Intl.NumberFormat("fr").format(3000n); diff --git a/tests/baselines/reference/bigintWithoutLib.types b/tests/baselines/reference/bigintWithoutLib.types index 9ba0ccf1c6142..0e3f93524f5d2 100644 --- a/tests/baselines/reference/bigintWithoutLib.types +++ b/tests/baselines/reference/bigintWithoutLib.types @@ -72,7 +72,7 @@ stringVal = bigintVal.toLocaleString(); // should not error - bigintVal inferred >bigintVal : bigint >toLocaleString : () => string -stringVal = bigintVal.toLocaleString('de-DE'); +stringVal = bigintVal.toLocaleString('de-DE'); // should not error - bigintVal inferred as {} >stringVal = bigintVal.toLocaleString('de-DE') : string >stringVal : string >bigintVal.toLocaleString('de-DE') : string @@ -81,16 +81,7 @@ stringVal = bigintVal.toLocaleString('de-DE'); >toLocaleString : () => string >'de-DE' : "de-DE" -stringVal = bigintVal.toLocaleString('de-DE'); ->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 error +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 @@ -102,19 +93,7 @@ stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should >style : string >'currency' : "currency" -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error ->stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string ->stringVal : string ->bigintVal.toLocaleString('de-DE', { style: 'unit' }) : string ->bigintVal.toLocaleString : () => string ->bigintVal : bigint ->toLocaleString : () => string ->'de-DE' : "de-DE" ->{ style: 'unit' } : { style: string; } ->style : string ->'unit' : "unit" - -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) +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 diff --git a/tests/cases/compiler/bigintWithLib.ts b/tests/cases/compiler/bigintWithLib.ts index eec2f027f5c14..a4701496550e5 100644 --- a/tests/cases/compiler/bigintWithLib.ts +++ b/tests/cases/compiler/bigintWithLib.ts @@ -12,9 +12,7 @@ let stringVal: string = bigintVal.toString(); stringVal = bigintVal.toString(2); stringVal = bigintVal.toLocaleString(); stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error +stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) // Test BigInt64Array diff --git a/tests/cases/compiler/bigintWithoutLib.ts b/tests/cases/compiler/bigintWithoutLib.ts index 516a1a394171e..da5965e3e8e9a 100644 --- a/tests/cases/compiler/bigintWithoutLib.ts +++ b/tests/cases/compiler/bigintWithoutLib.ts @@ -12,11 +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'); -stringVal = bigintVal.toLocaleString('de-DE'); -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'unit' }); // should error -stringVal = bigintVal.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }) +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();