Skip to content

Commit 25462be

Browse files
Merge pull request #28456 from Microsoft/nonExperimentalBigInt
BigInt shouldn't be considered experimental
2 parents 2b345cc + 624fdcb commit 25462be

File tree

30 files changed

+115
-88
lines changed

30 files changed

+115
-88
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30642,13 +30642,10 @@ namespace ts {
3064230642
isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent);
3064330643
if (!literalType) {
3064430644
if (languageVersion < ScriptTarget.ESNext) {
30645-
if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targetting_lower_than_ESNext)) {
30645+
if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
3064630646
return true;
3064730647
}
3064830648
}
30649-
if (!compilerOptions.experimentalBigInt) {
30650-
return grammarErrorOnNode(node, Diagnostics.Experimental_support_for_BigInt_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalBigInt_option_to_remove_this_warning);
30651-
}
3065230649
}
3065330650
return false;
3065430651
}

src/compiler/commandLineParser.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,6 @@ namespace ts {
584584
category: Diagnostics.Experimental_Options,
585585
description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
586586
},
587-
{
588-
name: "experimentalBigInt",
589-
type: "boolean",
590-
category: Diagnostics.Experimental_Options,
591-
description: Diagnostics.Enables_experimental_support_for_ESNext_BigInt_literals
592-
},
593587

594588
// Advanced
595589
{

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,10 +1011,6 @@
10111011
"category": "Message",
10121012
"code": 1350
10131013
},
1014-
"Experimental support for BigInt is a feature that is subject to change in a future release. Set the 'experimentalBigInt' option to remove this warning.": {
1015-
"category": "Error",
1016-
"code": 1351
1017-
},
10181014

10191015
"Duplicate identifier '{0}'.": {
10201016
"category": "Error",
@@ -2505,7 +2501,7 @@
25052501
"category": "Error",
25062502
"code": 2736
25072503
},
2508-
"BigInt literals are not available when targetting lower than ESNext.": {
2504+
"BigInt literals are not available when targeting lower than ESNext.": {
25092505
"category": "Error",
25102506
"code": 2737
25112507
},
@@ -3933,10 +3929,6 @@
39333929
"category": "Error",
39343930
"code": 6370
39353931
},
3936-
"Enables experimental support for ESNext BigInt literals.": {
3937-
"category": "Message",
3938-
"code": 6371
3939-
},
39403932

39413933
"The expected type comes from property '{0}' which is declared here on type '{1}'": {
39423934
"category": "Message",

src/compiler/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4495,7 +4495,6 @@ namespace ts {
44954495
downlevelIteration?: boolean;
44964496
emitBOM?: boolean;
44974497
emitDecoratorMetadata?: boolean;
4498-
experimentalBigInt?: boolean;
44994498
experimentalDecorators?: boolean;
45004499
forceConsistentCasingInFileNames?: boolean;
45014500
/*@internal*/help?: boolean;

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,6 @@ declare namespace ts {
24502450
downlevelIteration?: boolean;
24512451
emitBOM?: boolean;
24522452
emitDecoratorMetadata?: boolean;
2453-
experimentalBigInt?: boolean;
24542453
experimentalDecorators?: boolean;
24552454
forceConsistentCasingInFileNames?: boolean;
24562455
importHelpers?: boolean;

tests/baselines/reference/api/typescript.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,6 @@ declare namespace ts {
24502450
downlevelIteration?: boolean;
24512451
emitBOM?: boolean;
24522452
emitDecoratorMetadata?: boolean;
2453-
experimentalBigInt?: boolean;
24542453
experimentalDecorators?: boolean;
24552454
forceConsistentCasingInFileNames?: boolean;
24562455
importHelpers?: boolean;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
tests/cases/compiler/bigIntWithTargetES3.ts(5,22): error TS2737: BigInt literals are not available when targeting lower than ESNext.
2+
tests/cases/compiler/bigIntWithTargetES3.ts(5,29): error TS2737: BigInt literals are not available when targeting lower than ESNext.
3+
tests/cases/compiler/bigIntWithTargetES3.ts(5,39): error TS2737: BigInt literals are not available when targeting lower than ESNext.
4+
tests/cases/compiler/bigIntWithTargetES3.ts(5,48): error TS2737: BigInt literals are not available when targeting lower than ESNext.
5+
6+
7+
==== tests/cases/compiler/bigIntWithTargetES3.ts (4 errors) ====
8+
const normalNumber = 123; // should not error
9+
let bigintType: bigint; // should not error
10+
let bigintLiteralType: 123n; // should not error when used as type
11+
let bigintNegativeLiteralType: -123n; // should not error when used as type
12+
const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error
13+
~~~~
14+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
15+
~~~~~~~
16+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
17+
~~~~~~
18+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
19+
~~~~~
20+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
21+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//// [bigIntWithTargetES3.ts]
2+
const normalNumber = 123; // should not error
3+
let bigintType: bigint; // should not error
4+
let bigintLiteralType: 123n; // should not error when used as type
5+
let bigintNegativeLiteralType: -123n; // should not error when used as type
6+
const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error
7+
8+
9+
//// [bigIntWithTargetES3.js]
10+
var normalNumber = 123; // should not error
11+
var bigintType; // should not error
12+
var bigintLiteralType; // should not error when used as type
13+
var bigintNegativeLiteralType; // should not error when used as type
14+
var bigintNumber = 123n * 15n + 292n * 0x7fn; // each literal should error
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/bigIntWithTargetES3.ts ===
2+
const normalNumber = 123; // should not error
3+
>normalNumber : Symbol(normalNumber, Decl(bigIntWithTargetES3.ts, 0, 5))
4+
5+
let bigintType: bigint; // should not error
6+
>bigintType : Symbol(bigintType, Decl(bigIntWithTargetES3.ts, 1, 3))
7+
8+
let bigintLiteralType: 123n; // should not error when used as type
9+
>bigintLiteralType : Symbol(bigintLiteralType, Decl(bigIntWithTargetES3.ts, 2, 3))
10+
11+
let bigintNegativeLiteralType: -123n; // should not error when used as type
12+
>bigintNegativeLiteralType : Symbol(bigintNegativeLiteralType, Decl(bigIntWithTargetES3.ts, 3, 3))
13+
14+
const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error
15+
>bigintNumber : Symbol(bigintNumber, Decl(bigIntWithTargetES3.ts, 4, 5))
16+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/compiler/bigIntWithTargetES3.ts ===
2+
const normalNumber = 123; // should not error
3+
>normalNumber : 123
4+
>123 : 123
5+
6+
let bigintType: bigint; // should not error
7+
>bigintType : bigint
8+
9+
let bigintLiteralType: 123n; // should not error when used as type
10+
>bigintLiteralType : 123n
11+
12+
let bigintNegativeLiteralType: -123n; // should not error when used as type
13+
>bigintNegativeLiteralType : -123n
14+
>-123n : -123n
15+
>123n : 123n
16+
17+
const bigintNumber = 123n * 0b1111n + 0o444n * 0x7fn; // each literal should error
18+
>bigintNumber : bigint
19+
>123n * 0b1111n + 0o444n * 0x7fn : bigint
20+
>123n * 0b1111n : bigint
21+
>123n : 123n
22+
>0b1111n : 15n
23+
>0o444n * 0x7fn : bigint
24+
>0o444n : 292n
25+
>0x7fn : 127n
26+

tests/baselines/reference/bigintWithoutLib.errors.txt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ tests/cases/compiler/bigintWithoutLib.ts(4,25): error TS2304: Cannot find name '
22
tests/cases/compiler/bigintWithoutLib.ts(5,13): error TS2304: Cannot find name 'BigInt'.
33
tests/cases/compiler/bigintWithoutLib.ts(6,5): error TS2304: Cannot find name 'BigInt'.
44
tests/cases/compiler/bigintWithoutLib.ts(7,13): error TS2304: Cannot find name 'BigInt'.
5-
tests/cases/compiler/bigintWithoutLib.ts(7,30): error TS2737: BigInt literals are not available when targetting lower than ESNext.
5+
tests/cases/compiler/bigintWithoutLib.ts(7,30): error TS2737: BigInt literals are not available when targeting lower than ESNext.
66
tests/cases/compiler/bigintWithoutLib.ts(8,13): error TS2304: Cannot find name 'BigInt'.
7-
tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targetting lower than ESNext.
7+
tests/cases/compiler/bigintWithoutLib.ts(8,31): error TS2737: BigInt literals are not available when targeting lower than ESNext.
88
tests/cases/compiler/bigintWithoutLib.ts(9,1): error TS2322: Type 'Object' is not assignable to type 'bigint'.
99
tests/cases/compiler/bigintWithoutLib.ts(11,13): error TS2554: Expected 0 arguments, but got 1.
1010
tests/cases/compiler/bigintWithoutLib.ts(15,18): error TS2304: Cannot find name 'BigInt64Array'.
1111
tests/cases/compiler/bigintWithoutLib.ts(15,38): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
1212
tests/cases/compiler/bigintWithoutLib.ts(16,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
1313
tests/cases/compiler/bigintWithoutLib.ts(17,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
14-
tests/cases/compiler/bigintWithoutLib.ts(17,34): error TS2737: BigInt literals are not available when targetting lower than ESNext.
15-
tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2737: BigInt literals are not available when targetting lower than ESNext.
16-
tests/cases/compiler/bigintWithoutLib.ts(17,42): error TS2737: BigInt literals are not available when targetting lower than ESNext.
14+
tests/cases/compiler/bigintWithoutLib.ts(17,34): error TS2737: BigInt literals are not available when targeting lower than ESNext.
15+
tests/cases/compiler/bigintWithoutLib.ts(17,38): error TS2737: BigInt literals are not available when targeting lower than ESNext.
16+
tests/cases/compiler/bigintWithoutLib.ts(17,42): error TS2737: BigInt literals are not available when targeting lower than ESNext.
1717
tests/cases/compiler/bigintWithoutLib.ts(18,19): error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
1818
tests/cases/compiler/bigintWithoutLib.ts(19,19): error TS2304: Cannot find name 'BigInt64Array'.
1919
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
2222
tests/cases/compiler/bigintWithoutLib.ts(27,40): error TS2304: Cannot find name 'BigUint64Array'.
2323
tests/cases/compiler/bigintWithoutLib.ts(28,20): error TS2304: Cannot find name 'BigUint64Array'.
2424
tests/cases/compiler/bigintWithoutLib.ts(29,20): error TS2304: Cannot find name 'BigUint64Array'.
25-
tests/cases/compiler/bigintWithoutLib.ts(29,36): error TS2737: BigInt literals are not available when targetting lower than ESNext.
26-
tests/cases/compiler/bigintWithoutLib.ts(29,40): error TS2737: BigInt literals are not available when targetting lower than ESNext.
27-
tests/cases/compiler/bigintWithoutLib.ts(29,44): error TS2737: BigInt literals are not available when targetting lower than ESNext.
25+
tests/cases/compiler/bigintWithoutLib.ts(29,36): error TS2737: BigInt literals are not available when targeting lower than ESNext.
26+
tests/cases/compiler/bigintWithoutLib.ts(29,40): error TS2737: BigInt literals are not available when targeting lower than ESNext.
27+
tests/cases/compiler/bigintWithoutLib.ts(29,44): error TS2737: BigInt literals are not available when targeting lower than ESNext.
2828
tests/cases/compiler/bigintWithoutLib.ts(30,20): error TS2304: Cannot find name 'BigUint64Array'.
2929
tests/cases/compiler/bigintWithoutLib.ts(31,20): error TS2304: Cannot find name 'BigUint64Array'.
3030
tests/cases/compiler/bigintWithoutLib.ts(32,20): error TS2304: Cannot find name 'BigUint64Array'.
3131
tests/cases/compiler/bigintWithoutLib.ts(33,20): error TS2304: Cannot find name 'BigUint64Array'.
3232
tests/cases/compiler/bigintWithoutLib.ts(40,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
33-
tests/cases/compiler/bigintWithoutLib.ts(40,26): error TS2737: BigInt literals are not available when targetting lower than ESNext.
33+
tests/cases/compiler/bigintWithoutLib.ts(40,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
3434
tests/cases/compiler/bigintWithoutLib.ts(41,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
35-
tests/cases/compiler/bigintWithoutLib.ts(41,26): error TS2737: BigInt literals are not available when targetting lower than ESNext.
35+
tests/cases/compiler/bigintWithoutLib.ts(41,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
3636
tests/cases/compiler/bigintWithoutLib.ts(42,10): error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
3737
tests/cases/compiler/bigintWithoutLib.ts(43,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
38-
tests/cases/compiler/bigintWithoutLib.ts(43,26): error TS2737: BigInt literals are not available when targetting lower than ESNext.
38+
tests/cases/compiler/bigintWithoutLib.ts(43,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
3939
tests/cases/compiler/bigintWithoutLib.ts(44,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
40-
tests/cases/compiler/bigintWithoutLib.ts(44,26): error TS2737: BigInt literals are not available when targetting lower than ESNext.
40+
tests/cases/compiler/bigintWithoutLib.ts(44,26): error TS2737: BigInt literals are not available when targeting lower than ESNext.
4141
tests/cases/compiler/bigintWithoutLib.ts(45,10): error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
4242
tests/cases/compiler/bigintWithoutLib.ts(46,22): error TS2339: Property 'getBigInt64' does not exist on type 'DataView'.
4343
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
6262
~~~~~~
6363
!!! error TS2304: Cannot find name 'BigInt'.
6464
~~~~~~~
65-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
65+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
6666
bigintVal = BigInt.asUintN(8, 0xFFFFn);
6767
~~~~~~
6868
!!! error TS2304: Cannot find name 'BigInt'.
6969
~~~~~~~
70-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
70+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
7171
bigintVal = bigintVal.valueOf(); // should error - bigintVal inferred as {}
7272
~~~~~~~~~
7373
!!! 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
9393
!!! error TS2552: Cannot find name 'BigInt64Array'. Did you mean 'bigIntArray'?
9494
!!! related TS2728 tests/cases/compiler/bigintWithoutLib.ts:15:5: 'bigIntArray' is declared here.
9595
~~
96-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
96+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
9797
~~
98-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
98+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
9999
~~
100-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
100+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
101101
bigIntArray = new BigInt64Array([1, 2, 3]);
102102
~~~~~~~~~~~~~
103103
!!! 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
128128
~~~~~~~~~~~~~~
129129
!!! error TS2304: Cannot find name 'BigUint64Array'.
130130
~~
131-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
131+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
132132
~~
133-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
133+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
134134
~~
135-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
135+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
136136
bigUintArray = new BigUint64Array([1, 2, 3]);
137137
~~~~~~~~~~~~~~
138138
!!! error TS2304: Cannot find name 'BigUint64Array'.
@@ -155,25 +155,25 @@ tests/cases/compiler/bigintWithoutLib.ts(49,22): error TS2339: Property 'getBigU
155155
~~~~~~~~~~~
156156
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
157157
~~
158-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
158+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
159159
dataView.setBigInt64(1, -1n, true);
160160
~~~~~~~~~~~
161161
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
162162
~~
163-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
163+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
164164
dataView.setBigInt64(1, -1);
165165
~~~~~~~~~~~
166166
!!! error TS2339: Property 'setBigInt64' does not exist on type 'DataView'.
167167
dataView.setBigUint64(2, 123n);
168168
~~~~~~~~~~~~
169169
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
170170
~~~~
171-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
171+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
172172
dataView.setBigUint64(2, 123n, true);
173173
~~~~~~~~~~~~
174174
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.
175175
~~~~
176-
!!! error TS2737: BigInt literals are not available when targetting lower than ESNext.
176+
!!! error TS2737: BigInt literals are not available when targeting lower than ESNext.
177177
dataView.setBigUint64(2, 123);
178178
~~~~~~~~~~~~
179179
!!! error TS2339: Property 'setBigUint64' does not exist on type 'DataView'.

tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,5 @@
5656
/* Experimental Options */
5757
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
5858
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
59-
// "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */
6059
}
6160
}

tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
/* Experimental Options */
5757
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
5858
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
59-
// "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */
6059

6160
/* Advanced Options */
6261
"noErrorTruncation": true, /* Do not truncate error messages. */

tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,5 @@
5656
/* Experimental Options */
5757
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
5858
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
59-
// "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */
6059
}
6160
}

tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,5 @@
5656
/* Experimental Options */
5757
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
5858
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
59-
// "experimentalBigInt": true, /* Enables experimental support for ESNext BigInt literals. */
6059
}
6160
}

0 commit comments

Comments
 (0)