You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove Node12, add Node16.
* Accepted baselines.
* Refactor checking for top-level await, give a better error message in CJS files.
* Accepted baselines.
* Stop erroring on JSON module imports in node ESM since they're no longer experimental.
* Accepted baselines.
* More refactoring, do the same checks for for-await loops.
* Accepted baselines.
* Adjust phrasing to permit for-await on CJS error.
* Accepted baselines.
* Accepted baselines.
* Fix lints.
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -900,6 +900,10 @@
900
900
"category": "Error",
901
901
"code": 1308
902
902
},
903
+
"The current file is a CommonJS module and cannot use 'await' at the top level.": {
904
+
"category": "Error",
905
+
"code": 1309
906
+
},
903
907
"Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern.": {
904
908
"category": "Error",
905
909
"code": 1312
@@ -944,11 +948,11 @@
944
948
"category": "Error",
945
949
"code": 1322
946
950
},
947
-
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.": {
951
+
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'.": {
948
952
"category": "Error",
949
953
"code": 1323
950
954
},
951
-
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.": {
955
+
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.": {
952
956
"category": "Error",
953
957
"code": 1324
954
958
},
@@ -1016,7 +1020,7 @@
1016
1020
"category": "Error",
1017
1021
"code": 1342
1018
1022
},
1019
-
"The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.": {
1023
+
"The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.": {
1020
1024
"category": "Error",
1021
1025
"code": 1343
1022
1026
},
@@ -1140,7 +1144,7 @@
1140
1144
"category": "Message",
1141
1145
"code": 1377
1142
1146
},
1143
-
"Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
1147
+
"Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
1144
1148
"category": "Error",
1145
1149
"code": 1378
1146
1150
},
@@ -1348,7 +1352,7 @@
1348
1352
"category": "Error",
1349
1353
"code": 1431
1350
1354
},
1351
-
"Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
1355
+
"Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
1352
1356
"category": "Error",
1353
1357
"code": 1432
1354
1358
},
@@ -1420,7 +1424,7 @@
1420
1424
"category": "Error",
1421
1425
"code": 1451
1422
1426
},
1423
-
"Resolution modes are only supported when `moduleResolution` is `node12` or `nodenext`.": {
1427
+
"Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`.": {
1424
1428
"category": "Error",
1425
1429
"code": 1452
1426
1430
},
@@ -1465,7 +1469,7 @@
1465
1469
"category": "Message",
1466
1470
"code": 1475
1467
1471
},
1468
-
"\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node12+) as modules.": {
1472
+
"\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules.": {
1469
1473
"category": "Message",
1470
1474
"code": 1476
1471
1475
},
@@ -3418,11 +3422,11 @@
3418
3422
"category": "Error",
3419
3423
"code": 2833
3420
3424
},
3421
-
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.": {
3425
+
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.": {
3422
3426
"category": "Error",
3423
3427
"code": 2834
3424
3428
},
3425
-
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?": {
3429
+
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?": {
3426
3430
"category": "Error",
3427
3431
"code": 2835
3428
3432
},
@@ -6106,10 +6110,6 @@
6106
6110
"category": "Error",
6107
6111
"code": 7061
6108
6112
},
6109
-
"JSON imports are experimental in ES module mode imports.": {
Copy file name to clipboardExpand all lines: src/compiler/moduleNameResolver.ts
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -348,9 +348,9 @@ namespace ts {
348
348
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
349
349
// are present in a non-modal project; while in theory we'd like to either ignore the mode or provide faithful modern resolution, depending on what we feel is best,
350
350
// in practice, not every cache has the options available to intelligently make the choice to ignore the mode request, and it's unclear how modern "faithful modern
351
-
// resolution" should be (`node12`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
351
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
352
352
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
0 commit comments