mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 19:07:27 -06:00
Support bigints in ES2020 (#33874)
This commit is contained in:
parent
bed7c89354
commit
05a2f1b110
@ -36313,8 +36313,8 @@ namespace ts {
|
||||
const literalType = isLiteralTypeNode(node.parent) ||
|
||||
isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent);
|
||||
if (!literalType) {
|
||||
if (languageVersion < ScriptTarget.ESNext) {
|
||||
if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
|
||||
if (languageVersion < ScriptTarget.ES2020) {
|
||||
if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,13 +49,14 @@ namespace ts {
|
||||
["es2019.object", "lib.es2019.object.d.ts"],
|
||||
["es2019.string", "lib.es2019.string.d.ts"],
|
||||
["es2019.symbol", "lib.es2019.symbol.d.ts"],
|
||||
["es2020.bigint", "lib.es2020.bigint.d.ts"],
|
||||
["es2020.string", "lib.es2020.string.d.ts"],
|
||||
["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
|
||||
["esnext.array", "lib.es2019.array.d.ts"],
|
||||
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
||||
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
|
||||
["esnext.intl", "lib.esnext.intl.d.ts"],
|
||||
["esnext.bigint", "lib.esnext.bigint.d.ts"]
|
||||
["esnext.bigint", "lib.es2020.bigint.d.ts"]
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@ -2615,7 +2615,7 @@
|
||||
"category": "Error",
|
||||
"code": 2736
|
||||
},
|
||||
"BigInt literals are not available when targeting lower than ESNext.": {
|
||||
"BigInt literals are not available when targeting lower than ES2020.": {
|
||||
"category": "Error",
|
||||
"code": 2737
|
||||
},
|
||||
|
||||
1
src/lib/es2020.d.ts
vendored
1
src/lib/es2020.d.ts
vendored
@ -1,3 +1,4 @@
|
||||
/// <reference lib="es2019" />
|
||||
/// <reference lib="es2020.bigint" />
|
||||
/// <reference lib="es2020.string" />
|
||||
/// <reference lib="es2020.symbol.wellknown" />
|
||||
|
||||
1
src/lib/esnext.d.ts
vendored
1
src/lib/esnext.d.ts
vendored
@ -1,3 +1,2 @@
|
||||
/// <reference lib="es2020" />
|
||||
/// <reference lib="esnext.bigint" />
|
||||
/// <reference lib="esnext.intl" />
|
||||
|
||||
@ -40,9 +40,9 @@
|
||||
"es2019.object",
|
||||
"es2019.string",
|
||||
"es2019.symbol",
|
||||
"es2020.bigint",
|
||||
"es2020.string",
|
||||
"es2020.symbol.wellknown",
|
||||
"esnext.bigint",
|
||||
"esnext.intl",
|
||||
// Default libraries
|
||||
"es5.full",
|
||||
|
||||
@ -85,7 +85,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,invalidOption", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.bigint', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
file: undefined,
|
||||
@ -287,7 +287,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.bigint', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
file: undefined,
|
||||
@ -306,7 +306,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.bigint', 'es2020.string', 'es2020.symbol.wellknown', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
file: undefined,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,22): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,29): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,39): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,48): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,22): error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,29): error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,39): error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
tests/cases/compiler/bigIntWithTargetES3.ts(5,48): error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
|
||||
|
||||
==== tests/cases/compiler/bigIntWithTargetES3.ts (4 errors) ====
|
||||
@ -11,11 +11,11 @@ tests/cases/compiler/bigIntWithTargetES3.ts(5,48): error TS2737: BigInt literals
|
||||
let bigintNegativeLiteralType: -123n; // should not error when used as type
|
||||
const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error
|
||||
~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
~~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
|
||||
@ -4,21 +4,21 @@ function bigInt64ArraySubarray() {
|
||||
|
||||
var arr = new BigInt64Array(10);
|
||||
>arr : Symbol(arr, Decl(bigint64ArraySubarray.ts, 1, 7))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
arr.subarray();
|
||||
>arr.subarray : Symbol(BigInt64Array.subarray, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>arr.subarray : Symbol(BigInt64Array.subarray, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>arr : Symbol(arr, Decl(bigint64ArraySubarray.ts, 1, 7))
|
||||
>subarray : Symbol(BigInt64Array.subarray, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>subarray : Symbol(BigInt64Array.subarray, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
arr.subarray(0);
|
||||
>arr.subarray : Symbol(BigInt64Array.subarray, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>arr.subarray : Symbol(BigInt64Array.subarray, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>arr : Symbol(arr, Decl(bigint64ArraySubarray.ts, 1, 7))
|
||||
>subarray : Symbol(BigInt64Array.subarray, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>subarray : Symbol(BigInt64Array.subarray, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
arr.subarray(0, 10);
|
||||
>arr.subarray : Symbol(BigInt64Array.subarray, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>arr.subarray : Symbol(BigInt64Array.subarray, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>arr : Symbol(arr, Decl(bigint64ArraySubarray.ts, 1, 7))
|
||||
>subarray : Symbol(BigInt64Array.subarray, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>subarray : Symbol(BigInt64Array.subarray, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
}
|
||||
|
||||
|
||||
@ -56,4 +56,5 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
const c = {[bigNum]: 789};
|
||||
~~~~~~~~
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
|
||||
@ -29,7 +29,8 @@ typedArray[2] = 0xCC;
|
||||
// BigInt cannot be used as an object literal property
|
||||
const a = {1n: 123};
|
||||
const b = {[1n]: 456};
|
||||
const c = {[bigNum]: 789};
|
||||
const c = {[bigNum]: 789};
|
||||
|
||||
|
||||
//// [a.js]
|
||||
const arr = [1, 2, 3];
|
||||
|
||||
@ -112,4 +112,5 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
|
||||
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
|
||||
let z = 12n; // should emit type bigint in declaration file
|
||||
|
||||
@ -51,7 +51,8 @@ bigintVal = dataView.getBigUint64(2, true);
|
||||
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
|
||||
let z = 12n; // should emit type bigint in declaration file
|
||||
|
||||
|
||||
//// [bigintWithLib.js]
|
||||
// Test BigInt functions
|
||||
|
||||
@ -2,94 +2,94 @@
|
||||
// Test BigInt functions
|
||||
let bigintVal: bigint = BigInt(123);
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
bigintVal = BigInt("456");
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
new BigInt(123); // should error
|
||||
>BigInt : Symbol(BigInt, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
bigintVal = BigInt.asIntN(8, 0xFFFFn);
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>BigInt.asIntN : Symbol(BigIntConstructor.asIntN, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>asIntN : Symbol(BigIntConstructor.asIntN, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt.asIntN : Symbol(BigIntConstructor.asIntN, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>asIntN : Symbol(BigIntConstructor.asIntN, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
bigintVal = BigInt.asUintN(8, 0xFFFFn);
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>BigInt.asUintN : Symbol(BigIntConstructor.asUintN, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>asUintN : Symbol(BigIntConstructor.asUintN, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt.asUintN : Symbol(BigIntConstructor.asUintN, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>asUintN : Symbol(BigIntConstructor.asUintN, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
bigintVal = bigintVal.valueOf();
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>bigintVal.valueOf : Symbol(BigInt.valueOf, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>bigintVal.valueOf : Symbol(BigInt.valueOf, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>valueOf : Symbol(BigInt.valueOf, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>valueOf : Symbol(BigInt.valueOf, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
let stringVal: string = bigintVal.toString();
|
||||
>stringVal : Symbol(stringVal, Decl(bigintWithLib.ts, 7, 3))
|
||||
>bigintVal.toString : Symbol(BigInt.toString, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>bigintVal.toString : Symbol(BigInt.toString, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>toString : Symbol(BigInt.toString, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>toString : Symbol(BigInt.toString, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
stringVal = bigintVal.toString(2);
|
||||
>stringVal : Symbol(stringVal, Decl(bigintWithLib.ts, 7, 3))
|
||||
>bigintVal.toString : Symbol(BigInt.toString, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>bigintVal.toString : Symbol(BigInt.toString, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>bigintVal : Symbol(bigintVal, Decl(bigintWithLib.ts, 1, 3))
|
||||
>toString : Symbol(BigInt.toString, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>toString : Symbol(BigInt.toString, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
stringVal = bigintVal.toLocaleString();
|
||||
>stringVal : Symbol(stringVal, Decl(bigintWithLib.ts, 7, 3))
|
||||
>bigintVal.toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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.esnext.bigint.d.ts, --, --))
|
||||
>toLocaleString : Symbol(BigInt.toLocaleString, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
// Test BigInt64Array
|
||||
let bigIntArray: BigInt64Array = new BigInt64Array();
|
||||
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigInt64Array : Symbol(BigInt64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
bigIntArray.length = 10; // should error
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
let arrayBufferLike: ArrayBufferView = bigIntArray;
|
||||
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithLib.ts, 21, 3))
|
||||
@ -99,46 +99,46 @@ let arrayBufferLike: ArrayBufferView = bigIntArray;
|
||||
// Test BigUint64Array
|
||||
let bigUintArray: BigUint64Array = new BigUint64Array();
|
||||
>bigUintArray : Symbol(bigUintArray, Decl(bigintWithLib.ts, 24, 3))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>BigUint64Array : Symbol(BigUint64Array, Decl(lib.esnext.bigint.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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))
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
bigIntArray.length = 10; // should error
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>bigIntArray.length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>bigIntArray : Symbol(bigIntArray, Decl(bigintWithLib.ts, 12, 3))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>length : Symbol(BigInt64Array.length, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
arrayBufferLike = bigIntArray;
|
||||
>arrayBufferLike : Symbol(arrayBufferLike, Decl(bigintWithLib.ts, 21, 3))
|
||||
@ -147,62 +147,62 @@ arrayBufferLike = bigIntArray;
|
||||
// Test added DataView methods
|
||||
const dataView = new DataView(new ArrayBuffer(80));
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>DataView : Symbol(DataView, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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.esnext.bigint.d.ts, --, --))
|
||||
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
dataView.setBigInt64(1, -1n, true);
|
||||
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
dataView.setBigInt64(1, -1); // should error
|
||||
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>dataView.setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>setBigInt64 : Symbol(DataView.setBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
dataView.setBigUint64(2, 123n);
|
||||
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
dataView.setBigUint64(2, 123n, true);
|
||||
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
dataView.setBigUint64(2, 123); // should error
|
||||
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>dataView.setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>setBigUint64 : Symbol(DataView.setBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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.esnext.bigint.d.ts, --, --))
|
||||
>dataView.getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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.esnext.bigint.d.ts, --, --))
|
||||
>dataView.getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>getBigInt64 : Symbol(DataView.getBigInt64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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.esnext.bigint.d.ts, --, --))
|
||||
>dataView.getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>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.esnext.bigint.d.ts, --, --))
|
||||
>dataView.getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
>dataView : Symbol(dataView, Decl(bigintWithLib.ts, 36, 5))
|
||||
>getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.esnext.bigint.d.ts, --, --))
|
||||
>getBigUint64 : Symbol(DataView.getBigUint64, Decl(lib.es2020.bigint.d.ts, --, --))
|
||||
|
||||
// Test emitted declarations files
|
||||
const w = 12n; // should emit as const w = 12n
|
||||
|
||||
@ -2,18 +2,18 @@ tests/cases/compiler/bigintWithoutLib.ts(4,25): error TS2304: Cannot find name '
|
||||
tests/cases/compiler/bigintWithoutLib.ts(5,13): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(6,5): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(7,13): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(7,30): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(7,30): error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(8,13): error TS2304: Cannot find name 'BigInt'.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
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 ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(17,42): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
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'.
|
||||
@ -22,22 +22,22 @@ tests/cases/compiler/bigintWithoutLib.ts(27,19): error TS2304: Cannot find name
|
||||
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 ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,40): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
tests/cases/compiler/bigintWithoutLib.ts(29,44): error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
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(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 ESNext.
|
||||
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 ESNext.
|
||||
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 ESNext.
|
||||
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 ESNext.
|
||||
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'.
|
||||
@ -62,12 +62,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigInt'.
|
||||
~~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
bigintVal = BigInt.asUintN(8, 0xFFFFn);
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigInt'.
|
||||
~~~~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {}
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'bigint'.
|
||||
@ -93,11 +93,11 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:15:5: 'bigIntArray' is declared here.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
bigIntArray = new BigInt64Array([1, 2, 3]);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
|
||||
@ -128,11 +128,11 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigUint64Array'.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
bigUintArray = new BigUint64Array([1, 2, 3]);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'BigUint64Array'.
|
||||
@ -155,12 +155,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
dataView.setBigInt64(1, -1n, true);
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
dataView.setBigInt64(1, -1);
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
|
||||
@ -168,12 +168,12 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
dataView.setBigUint64(2, 123n, true);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
~~~~
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
|
||||
!!! error TS2737: BigInt literals are not available when targeting lower than ES2020.
|
||||
dataView.setBigUint64(2, 123);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// @target: esnext
|
||||
// @target: es2020
|
||||
|
||||
function bigInt64ArraySubarray() {
|
||||
var arr = new BigInt64Array(10);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// @target: esnext
|
||||
// @target: es2020
|
||||
|
||||
// @filename: a.ts
|
||||
interface BigIntIndex<E> {
|
||||
@ -29,4 +29,4 @@ typedArray[2] = 0xCC;
|
||||
// BigInt cannot be used as an object literal property
|
||||
const a = {1n: 123};
|
||||
const b = {[1n]: 456};
|
||||
const c = {[bigNum]: 789};
|
||||
const c = {[bigNum]: 789};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// @target: esnext
|
||||
// @target: es2020
|
||||
// @declaration: true
|
||||
|
||||
// Test BigInt functions
|
||||
@ -53,4 +53,4 @@ bigintVal = dataView.getBigUint64(2, true);
|
||||
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
|
||||
let z = 12n; // should emit type bigint in declaration file
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user