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
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json
+8
Original file line number
Diff line number
Diff line change
@@ -3345,6 +3345,14 @@
3345
3345
"category": "Error",
3346
3346
"code": 2833
3347
3347
},
3348
+
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.": {
3349
+
"category": "Error",
3350
+
"code": 2834
3351
+
},
3352
+
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?": {
3353
+
"category": "Error",
3354
+
"code": 2835
3355
+
},
3348
3356
3349
3357
"Import declaration '{0}' is using private name '{1}'.": {
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.mjs'?
2
+
/src/bar.mts(3,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.
3
+
4
+
5
+
==== /src/foo.mts (0 errors) ====
6
+
export function foo() {
7
+
return "";
8
+
}
9
+
10
+
==== /src/bar.mts (2 errors) ====
11
+
// Extensionless relative path ES import in an ES module
12
+
import { foo } from "./foo"; // should error, suggest adding ".mjs"
13
+
~~~~~~~
14
+
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.mjs'?
15
+
import { baz } from "./baz"; // should error, ask for extension, no extension suggestion
16
+
~~~~~~~
17
+
!!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.jsx'?
2
+
3
+
4
+
==== /src/foo.tsx (0 errors) ====
5
+
export function foo() {
6
+
return "";
7
+
}
8
+
9
+
==== /src/bar.mts (1 errors) ====
10
+
// Extensionless relative path ES import in an ES module
11
+
import { foo } from "./foo"; // should error, suggest adding ".jsx"
12
+
~~~~~~~
13
+
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.jsx'?
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.js'?
2
+
3
+
4
+
==== /src/foo.tsx (0 errors) ====
5
+
export function foo() {
6
+
return "";
7
+
}
8
+
9
+
==== /src/bar.mts (1 errors) ====
10
+
// Extensionless relative path ES import in an ES module
11
+
import { foo } from "./foo"; // should error, suggest adding ".js"
12
+
~~~~~~~
13
+
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.js'?
/src/buzz.mts(2,8): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.
2
+
3
+
4
+
==== /src/buzz.mts (1 errors) ====
5
+
// Extensionless relative path dynamic import in an ES module
6
+
import("./foo").then(x => x); // should error, ask for extension
7
+
~~~~~~~
8
+
!!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.
0 commit comments