Skip to content

Commit 2c5b9a9

Browse files
committed
Changes to copy
1 parent 8ba5d7c commit 2c5b9a9

10 files changed

+81
-81
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39685,7 +39685,7 @@ namespace ts {
3968539685
return grammarErrorOnNode(declaration.assertClause,
3968639686
moduleKind === ModuleKind.NodeNext
3968739687
? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls
39688-
: Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext);
39688+
: Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext);
3968939689
}
3969039690

3969139691
if (isImportDeclaration(declaration) ? declaration.importClause?.isTypeOnly : declaration.isTypeOnly) {
@@ -43901,7 +43901,7 @@ namespace ts {
4390143901

4390243902
if (nodeArguments.length > 1) {
4390343903
const assertionArgument = nodeArguments[1];
43904-
return grammarErrorOnNode(assertionArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext);
43904+
return grammarErrorOnNode(assertionArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext);
4390543905
}
4390643906
}
4390743907

src/compiler/diagnosticMessages.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@
924924
"category": "Error",
925925
"code": 1323
926926
},
927-
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.": {
927+
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.": {
928928
"category": "Error",
929929
"code": 1324
930930
},
@@ -3333,7 +3333,7 @@
33333333
"category": "Error",
33343334
"code": 2820
33353335
},
3336-
"Import assertions are only supported when the '--module' option is set to 'esnext'.": {
3336+
"Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.": {
33373337
"category": "Error",
33383338
"code": 2821
33393339
},
@@ -3353,7 +3353,7 @@
33533353
"category": "Error",
33543354
"code": 2835
33553355
},
3356-
"Import assertions are not allowed on statements that transpile to commonjs require calls.": {
3356+
"Import assertions are not allowed on statements that transpile to commonjs 'require' calls.": {
33573357
"category": "Error",
33583358
"code": 2836
33593359
},

tests/baselines/reference/importAssertion1(module=commonjs).errors.txt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
tests/cases/conformance/importAssertion/1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
2-
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
3-
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
4-
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
5-
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
6-
tests/cases/conformance/importAssertion/3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
7-
tests/cases/conformance/importAssertion/3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
8-
tests/cases/conformance/importAssertion/3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
9-
tests/cases/conformance/importAssertion/3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
10-
tests/cases/conformance/importAssertion/3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
1+
tests/cases/conformance/importAssertion/1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2+
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
3+
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
4+
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
5+
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
6+
tests/cases/conformance/importAssertion/3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
7+
tests/cases/conformance/importAssertion/3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
8+
tests/cases/conformance/importAssertion/3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
9+
tests/cases/conformance/importAssertion/3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
10+
tests/cases/conformance/importAssertion/3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
1111
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
12-
tests/cases/conformance/importAssertion/3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
13-
tests/cases/conformance/importAssertion/3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
12+
tests/cases/conformance/importAssertion/3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
13+
tests/cases/conformance/importAssertion/3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
1414
tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comma not allowed.
1515

1616

@@ -21,13 +21,13 @@ tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comm
2121
==== tests/cases/conformance/importAssertion/1.ts (3 errors) ====
2222
import './0' assert { type: "json" }
2323
~~~~~~~~~~~~~~~~~~~~~~~
24-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
24+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2525
import { a, b } from './0' assert { "type": "json" }
2626
~~~~~~~~~~~~~~~~~~~~~~~~~
27-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
27+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2828
import * as foo from './0' assert { type: "json" }
2929
~~~~~~~~~~~~~~~~~~~~~~~
30-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
30+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
3131
a;
3232
b;
3333
foo.a;
@@ -36,10 +36,10 @@ tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comm
3636
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
3737
import { a, b } from './0' assert {}
3838
~~~~~~~~~
39-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
39+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
4040
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
4141
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
42+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
4343
a;
4444
b;
4545
c;
@@ -49,29 +49,29 @@ tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comm
4949
const a = import('./0')
5050
const b = import('./0', { assert: { type: "json" } })
5151
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52-
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
52+
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
5353
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
5454
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55-
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
55+
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
5656
const d = import('./0', { assert: {} })
5757
~~~~~~~~~~~~~~
58-
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
58+
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
5959
const dd = import('./0', {})
6060
~~
61-
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
61+
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
6262
declare function foo(): any;
6363
const e = import('./0', foo())
6464
~~~~~
65-
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
65+
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
6666
const f = import()
6767
~~~~~~~~
6868
!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
6969
const g = import('./0', {}, {})
7070
~~
71-
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
71+
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
7272
const h = import('./0', { assert: { type: "json" }},)
7373
~~~~~~~~~~~~~~~~~~~~~~~~~~~
74-
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
74+
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
7575
~
7676
!!! error TS1009: Trailing comma not allowed.
7777

tests/baselines/reference/importAssertion1(module=es2015).errors.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
tests/cases/conformance/importAssertion/1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
2-
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
3-
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
4-
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
5-
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
1+
tests/cases/conformance/importAssertion/1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2+
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
3+
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
4+
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
5+
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
66
tests/cases/conformance/importAssertion/3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
77
tests/cases/conformance/importAssertion/3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
88
tests/cases/conformance/importAssertion/3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
@@ -21,13 +21,13 @@ tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic impor
2121
==== tests/cases/conformance/importAssertion/1.ts (3 errors) ====
2222
import './0' assert { type: "json" }
2323
~~~~~~~~~~~~~~~~~~~~~~~
24-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
24+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2525
import { a, b } from './0' assert { "type": "json" }
2626
~~~~~~~~~~~~~~~~~~~~~~~~~
27-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
27+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2828
import * as foo from './0' assert { type: "json" }
2929
~~~~~~~~~~~~~~~~~~~~~~~
30-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
30+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
3131
a;
3232
b;
3333
foo.a;
@@ -36,10 +36,10 @@ tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic impor
3636
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
3737
import { a, b } from './0' assert {}
3838
~~~~~~~~~
39-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
39+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
4040
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
4141
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
42+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
4343
a;
4444
b;
4545
c;
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
tests/cases/conformance/importAssertion/1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
2-
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
3-
tests/cases/conformance/importAssertion/1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
4-
tests/cases/conformance/importAssertion/1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
5-
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
6-
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
1+
tests/cases/conformance/importAssertion/1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2+
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
3+
tests/cases/conformance/importAssertion/1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
4+
tests/cases/conformance/importAssertion/1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
5+
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
6+
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
77

88

99
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
@@ -13,22 +13,22 @@ tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import asserti
1313
==== tests/cases/conformance/importAssertion/1.ts (4 errors) ====
1414
export {} from './0' assert { type: "json" }
1515
~~~~~~~~~~~~~~~~~~~~~~~
16-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
16+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
1717
export { a, b } from './0' assert { type: "json" }
1818
~~~~~~~~~~~~~~~~~~~~~~~
19-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
19+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2020
export * from './0' assert { type: "json" }
2121
~~~~~~~~~~~~~~~~~~~~~~~
22-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
22+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2323
export * as ns from './0' assert { type: "json" }
2424
~~~~~~~~~~~~~~~~~~~~~~~
25-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
25+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
2626

2727
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
2828
export { a, b } from './0' assert {}
2929
~~~~~~~~~
30-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
30+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
3131
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
3232
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
33+
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
3434

0 commit comments

Comments
 (0)