diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bcf3a78f052c5..492ad331b2d86 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1015,6 +1015,22 @@ namespace ts { const builtinGlobals = createSymbolTable(); builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol); + // Extensions suggested for path imports when module resolution is node12 or higher. + // The first element of each tuple is the extension a file has. + // The second element of each tuple is the extension that should be used in a path import. + // e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs". + const suggestedExtensions: [string, string][] = [ + [".mts", ".mjs"], + [".ts", ".js"], + [".cts", ".cjs"], + [".mjs", ".mjs"], + [".js", ".js"], + [".cjs", ".cjs"], + [".tsx", compilerOptions.jsx === JsxEmit.Preserve ? ".jsx" : ".js"], + [".jsx", ".jsx"], + [".json", ".json"], + ]; + initializeTypeChecker(); return checker; @@ -3417,7 +3433,7 @@ namespace ts { (isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)?.name || (isLiteralImportTypeNode(location) ? location : undefined)?.argument.literal; const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat; - const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode)!; // TODO: GH#18217 + const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode); const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule); const sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { @@ -3460,10 +3476,10 @@ namespace ts { if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === undefined || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) { if (isForAugmentation) { const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule!.resolvedFileName); } else { - errorOnImplicitAnyModule(/*isError*/ noImplicitAny && !!moduleNotFoundError, errorNode, resolvedModule, moduleReference); + errorOnImplicitAnyModule(/*isError*/ noImplicitAny && !!moduleNotFoundError, errorNode, resolvedModule!, moduleReference); } // Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first. return undefined; @@ -3484,6 +3500,10 @@ namespace ts { } else { const tsExtension = tryExtractTSExtension(moduleReference); + const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference); + const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions); + const resolutionIsNode12OrNext = moduleResolutionKind === ModuleResolutionKind.Node12 || + moduleResolutionKind === ModuleResolutionKind.NodeNext; if (tsExtension) { const diag = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead; const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension); @@ -3503,6 +3523,18 @@ namespace ts { hasJsonModuleEmitEnabled(compilerOptions)) { error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference); } + else if (mode === ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) { + const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path)); + const suggestedExt = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))?.[1]; + if (suggestedExt) { + error(errorNode, + Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0, + moduleReference + suggestedExt); + } + else { + error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path); + } + } else { error(errorNode, moduleNotFoundError, moduleReference); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index a40439d012afd..267a8efc4799b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3341,6 +3341,14 @@ "category": "Error", "code": 2833 }, + "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.": { + "category": "Error", + "code": 2834 + }, + "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?": { + "category": "Error", + "code": 2835 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a5b143e06f3bd..4c339b18fc495 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5983,7 +5983,7 @@ namespace ts { export enum ModuleResolutionKind { Classic = 1, NodeJs = 2, - // Starting with node12, node's module resolver has significant departures from tranditional cjs resolution + // Starting with node12, node's module resolver has significant departures from traditional cjs resolution // to better support ecmascript modules and their use within node - more features are still being added, so // we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12` // version-anchored resolution target diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension1.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension1.errors.txt new file mode 100644 index 0000000000000..5f3cbbc121cfb --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension1.errors.txt @@ -0,0 +1,18 @@ +/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'? +/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. + + +==== /src/foo.mts (0 errors) ==== + export function foo() { + return ""; + } + +==== /src/bar.mts (2 errors) ==== + // Extensionless relative path ES import in an ES module + import { foo } from "./foo"; // should error, suggest adding ".mjs" + ~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.mjs'? + import { baz } from "./baz"; // should error, ask for extension, no extension suggestion + ~~~~~~~ +!!! 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. + \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension1.js b/tests/baselines/reference/moduleResolutionWithoutExtension1.js new file mode 100644 index 0000000000000..39f3af1bcb538 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension1.js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts] //// + +//// [foo.mts] +export function foo() { + return ""; +} + +//// [bar.mts] +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".mjs" +import { baz } from "./baz"; // should error, ask for extension, no extension suggestion + + +//// [foo.mjs] +export function foo() { + return ""; +} +//// [bar.mjs] +export {}; diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension1.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension1.symbols new file mode 100644 index 0000000000000..5b3588c39019d --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension1.symbols @@ -0,0 +1,15 @@ +=== /src/foo.mts === +export function foo() { +>foo : Symbol(foo, Decl(foo.mts, 0, 0)) + + return ""; +} + +=== /src/bar.mts === +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".mjs" +>foo : Symbol(foo, Decl(bar.mts, 1, 8)) + +import { baz } from "./baz"; // should error, ask for extension, no extension suggestion +>baz : Symbol(baz, Decl(bar.mts, 2, 8)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension1.types b/tests/baselines/reference/moduleResolutionWithoutExtension1.types new file mode 100644 index 0000000000000..79b5c11773d59 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension1.types @@ -0,0 +1,16 @@ +=== /src/foo.mts === +export function foo() { +>foo : () => string + + return ""; +>"" : "" +} + +=== /src/bar.mts === +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".mjs" +>foo : any + +import { baz } from "./baz"; // should error, ask for extension, no extension suggestion +>baz : any + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension2.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension2.errors.txt new file mode 100644 index 0000000000000..e541ad83a67cd --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension2.errors.txt @@ -0,0 +1,8 @@ +/src/buzz.mts(2,22): error TS2307: Cannot find module './foo' or its corresponding type declarations. + + +==== /src/buzz.mts (1 errors) ==== + // Extensionless relative path cjs import in an ES module + import foo = require("./foo"); // should error, should not ask for extension + ~~~~~~~ +!!! error TS2307: Cannot find module './foo' or its corresponding type declarations. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension2.js b/tests/baselines/reference/moduleResolutionWithoutExtension2.js new file mode 100644 index 0000000000000..f5d7cf95c75ee --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension2.js @@ -0,0 +1,6 @@ +//// [buzz.mts] +// Extensionless relative path cjs import in an ES module +import foo = require("./foo"); // should error, should not ask for extension + +//// [buzz.mjs] +export {}; diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension2.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension2.symbols new file mode 100644 index 0000000000000..c10eaa8a5b21b --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension2.symbols @@ -0,0 +1,5 @@ +=== /src/buzz.mts === +// Extensionless relative path cjs import in an ES module +import foo = require("./foo"); // should error, should not ask for extension +>foo : Symbol(foo, Decl(buzz.mts, 0, 0)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension2.types b/tests/baselines/reference/moduleResolutionWithoutExtension2.types new file mode 100644 index 0000000000000..89d7b057c8fae --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension2.types @@ -0,0 +1,5 @@ +=== /src/buzz.mts === +// Extensionless relative path cjs import in an ES module +import foo = require("./foo"); // should error, should not ask for extension +>foo : any + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension3.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension3.errors.txt new file mode 100644 index 0000000000000..0c753a1029900 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension3.errors.txt @@ -0,0 +1,14 @@ +/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'? + + +==== /src/foo.tsx (0 errors) ==== + export function foo() { + return ""; + } + +==== /src/bar.mts (1 errors) ==== + // Extensionless relative path ES import in an ES module + import { foo } from "./foo"; // should error, suggest adding ".jsx" + ~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.jsx'? + \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension3.js b/tests/baselines/reference/moduleResolutionWithoutExtension3.js new file mode 100644 index 0000000000000..964402755a434 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension3.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts] //// + +//// [foo.tsx] +export function foo() { + return ""; +} + +//// [bar.mts] +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".jsx" + + +//// [foo.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = void 0; +function foo() { + return ""; +} +exports.foo = foo; +//// [bar.mjs] +export {}; diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension3.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension3.symbols new file mode 100644 index 0000000000000..707433d072a60 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension3.symbols @@ -0,0 +1,12 @@ +=== /src/foo.tsx === +export function foo() { +>foo : Symbol(foo, Decl(foo.tsx, 0, 0)) + + return ""; +} + +=== /src/bar.mts === +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".jsx" +>foo : Symbol(foo, Decl(bar.mts, 1, 8)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension3.types b/tests/baselines/reference/moduleResolutionWithoutExtension3.types new file mode 100644 index 0000000000000..a94a6890b6898 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension3.types @@ -0,0 +1,13 @@ +=== /src/foo.tsx === +export function foo() { +>foo : () => string + + return ""; +>"" : "" +} + +=== /src/bar.mts === +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".jsx" +>foo : any + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension4.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension4.errors.txt new file mode 100644 index 0000000000000..afd24269d69bc --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension4.errors.txt @@ -0,0 +1,14 @@ +/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'? + + +==== /src/foo.tsx (0 errors) ==== + export function foo() { + return ""; + } + +==== /src/bar.mts (1 errors) ==== + // Extensionless relative path ES import in an ES module + import { foo } from "./foo"; // should error, suggest adding ".js" + ~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.js'? + \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension4.js b/tests/baselines/reference/moduleResolutionWithoutExtension4.js new file mode 100644 index 0000000000000..b67ea6284a3ff --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension4.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts] //// + +//// [foo.tsx] +export function foo() { + return ""; +} + +//// [bar.mts] +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".js" + + +//// [foo.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = void 0; +function foo() { + return ""; +} +exports.foo = foo; +//// [bar.mjs] +export {}; diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension4.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension4.symbols new file mode 100644 index 0000000000000..ba19300835274 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension4.symbols @@ -0,0 +1,12 @@ +=== /src/foo.tsx === +export function foo() { +>foo : Symbol(foo, Decl(foo.tsx, 0, 0)) + + return ""; +} + +=== /src/bar.mts === +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".js" +>foo : Symbol(foo, Decl(bar.mts, 1, 8)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension4.types b/tests/baselines/reference/moduleResolutionWithoutExtension4.types new file mode 100644 index 0000000000000..e72345bda427d --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension4.types @@ -0,0 +1,13 @@ +=== /src/foo.tsx === +export function foo() { +>foo : () => string + + return ""; +>"" : "" +} + +=== /src/bar.mts === +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".js" +>foo : any + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension5.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension5.errors.txt new file mode 100644 index 0000000000000..b4b0a89ae974f --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension5.errors.txt @@ -0,0 +1,8 @@ +/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. + + +==== /src/buzz.mts (1 errors) ==== + // Extensionless relative path dynamic import in an ES module + import("./foo").then(x => x); // should error, ask for extension + ~~~~~~~ +!!! 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. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension5.js b/tests/baselines/reference/moduleResolutionWithoutExtension5.js new file mode 100644 index 0000000000000..b79c4d0d548b0 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension5.js @@ -0,0 +1,7 @@ +//// [buzz.mts] +// Extensionless relative path dynamic import in an ES module +import("./foo").then(x => x); // should error, ask for extension + +//// [buzz.mjs] +// Extensionless relative path dynamic import in an ES module +import("./foo").then(x => x); // should error, ask for extension diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension5.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension5.symbols new file mode 100644 index 0000000000000..d66bb3d0fff5b --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension5.symbols @@ -0,0 +1,8 @@ +=== /src/buzz.mts === +// Extensionless relative path dynamic import in an ES module +import("./foo").then(x => x); // should error, ask for extension +>import("./foo").then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(buzz.mts, 1, 21)) +>x : Symbol(x, Decl(buzz.mts, 1, 21)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension5.types b/tests/baselines/reference/moduleResolutionWithoutExtension5.types new file mode 100644 index 0000000000000..d18f5276dba1c --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension5.types @@ -0,0 +1,12 @@ +=== /src/buzz.mts === +// Extensionless relative path dynamic import in an ES module +import("./foo").then(x => x); // should error, ask for extension +>import("./foo").then(x => x) : Promise +>import("./foo").then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import("./foo") : Promise +>"./foo" : "./foo" +>then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>x => x : (x: any) => any +>x : any +>x : any + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension6.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension6.errors.txt new file mode 100644 index 0000000000000..267a4cd5a0a53 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension6.errors.txt @@ -0,0 +1,10 @@ +/src/bar.cts(4,21): error TS2307: Cannot find module './foo' or its corresponding type declarations. + + +==== /src/bar.cts (1 errors) ==== + // Extensionless relative path import statement in a cjs module + // Import statements are not allowed in cjs files, + // but other errors should not assume that they are allowed + import { foo } from "./foo"; // should error, should not ask for extension + ~~~~~~~ +!!! error TS2307: Cannot find module './foo' or its corresponding type declarations. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension6.js b/tests/baselines/reference/moduleResolutionWithoutExtension6.js new file mode 100644 index 0000000000000..0df0659f2d516 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension6.js @@ -0,0 +1,9 @@ +//// [bar.cts] +// Extensionless relative path import statement in a cjs module +// Import statements are not allowed in cjs files, +// but other errors should not assume that they are allowed +import { foo } from "./foo"; // should error, should not ask for extension + +//// [bar.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension6.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension6.symbols new file mode 100644 index 0000000000000..0e0f1e7963667 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension6.symbols @@ -0,0 +1,7 @@ +=== /src/bar.cts === +// Extensionless relative path import statement in a cjs module +// Import statements are not allowed in cjs files, +// but other errors should not assume that they are allowed +import { foo } from "./foo"; // should error, should not ask for extension +>foo : Symbol(foo, Decl(bar.cts, 3, 8)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension6.types b/tests/baselines/reference/moduleResolutionWithoutExtension6.types new file mode 100644 index 0000000000000..7b87af3ccf3b3 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension6.types @@ -0,0 +1,7 @@ +=== /src/bar.cts === +// Extensionless relative path import statement in a cjs module +// Import statements are not allowed in cjs files, +// but other errors should not assume that they are allowed +import { foo } from "./foo"; // should error, should not ask for extension +>foo : any + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension7.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension7.errors.txt new file mode 100644 index 0000000000000..0ff660b3418e3 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension7.errors.txt @@ -0,0 +1,8 @@ +/src/bar.cts(2,22): error TS2307: Cannot find module './foo' or its corresponding type declarations. + + +==== /src/bar.cts (1 errors) ==== + // Extensionless relative path cjs import in a cjs module + import foo = require("./foo"); // should error, should not ask for extension + ~~~~~~~ +!!! error TS2307: Cannot find module './foo' or its corresponding type declarations. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension7.js b/tests/baselines/reference/moduleResolutionWithoutExtension7.js new file mode 100644 index 0000000000000..949b36a9d1da8 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension7.js @@ -0,0 +1,7 @@ +//// [bar.cts] +// Extensionless relative path cjs import in a cjs module +import foo = require("./foo"); // should error, should not ask for extension + +//// [bar.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension7.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension7.symbols new file mode 100644 index 0000000000000..4397e9a2e294f --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension7.symbols @@ -0,0 +1,5 @@ +=== /src/bar.cts === +// Extensionless relative path cjs import in a cjs module +import foo = require("./foo"); // should error, should not ask for extension +>foo : Symbol(foo, Decl(bar.cts, 0, 0)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension7.types b/tests/baselines/reference/moduleResolutionWithoutExtension7.types new file mode 100644 index 0000000000000..1ebf99baf94cb --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension7.types @@ -0,0 +1,5 @@ +=== /src/bar.cts === +// Extensionless relative path cjs import in a cjs module +import foo = require("./foo"); // should error, should not ask for extension +>foo : any + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension8.errors.txt b/tests/baselines/reference/moduleResolutionWithoutExtension8.errors.txt new file mode 100644 index 0000000000000..c990522c6c707 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension8.errors.txt @@ -0,0 +1,8 @@ +/src/bar.cts(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. + + +==== /src/bar.cts (1 errors) ==== + // Extensionless relative path dynamic import in a cjs module + import("./foo").then(x => x); // should error, ask for extension + ~~~~~~~ +!!! 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. \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension8.js b/tests/baselines/reference/moduleResolutionWithoutExtension8.js new file mode 100644 index 0000000000000..593f3668b3c73 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension8.js @@ -0,0 +1,7 @@ +//// [bar.cts] +// Extensionless relative path dynamic import in a cjs module +import("./foo").then(x => x); // should error, ask for extension + +//// [bar.cjs] +// Extensionless relative path dynamic import in a cjs module +import("./foo").then(x => x); // should error, ask for extension diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension8.symbols b/tests/baselines/reference/moduleResolutionWithoutExtension8.symbols new file mode 100644 index 0000000000000..deded53a4ec65 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension8.symbols @@ -0,0 +1,8 @@ +=== /src/bar.cts === +// Extensionless relative path dynamic import in a cjs module +import("./foo").then(x => x); // should error, ask for extension +>import("./foo").then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(bar.cts, 1, 21)) +>x : Symbol(x, Decl(bar.cts, 1, 21)) + diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension8.types b/tests/baselines/reference/moduleResolutionWithoutExtension8.types new file mode 100644 index 0000000000000..fdde64edc490c --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithoutExtension8.types @@ -0,0 +1,12 @@ +=== /src/bar.cts === +// Extensionless relative path dynamic import in a cjs module +import("./foo").then(x => x); // should error, ask for extension +>import("./foo").then(x => x) : Promise +>import("./foo").then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import("./foo") : Promise +>"./foo" : "./foo" +>then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>x => x : (x: any) => any +>x : any +>x : any + diff --git a/tests/baselines/reference/nodeModules1(module=node12).errors.txt b/tests/baselines/reference/nodeModules1(module=node12).errors.txt index 6398640a86946..724e3b73ed7b2 100644 --- a/tests/baselines/reference/nodeModules1(module=node12).errors.txt +++ b/tests/baselines/reference/nodeModules1(module=node12).errors.txt @@ -15,70 +15,70 @@ tests/cases/conformance/node/index.cts(59,22): error TS1471: Module './subfolder tests/cases/conformance/node/index.cts(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.cts(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(76,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(77,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(78,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(79,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(80,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(81,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(82,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(83,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(84,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(85,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.cts(77,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. +tests/cases/conformance/node/index.cts(78,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. +tests/cases/conformance/node/index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.cts(80,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. +tests/cases/conformance/node/index.cts(81,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. +tests/cases/conformance/node/index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.cts(83,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. +tests/cases/conformance/node/index.cts(84,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. +tests/cases/conformance/node/index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.mts(16,22): 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. +tests/cases/conformance/node/index.mts(17,22): 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. +tests/cases/conformance/node/index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.mts(19,22): 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. +tests/cases/conformance/node/index.mts(20,22): 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. +tests/cases/conformance/node/index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.mts(22,22): 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. +tests/cases/conformance/node/index.mts(23,22): 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. +tests/cases/conformance/node/index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.mts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.mts(76,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. +tests/cases/conformance/node/index.mts(77,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. +tests/cases/conformance/node/index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.mts(79,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. +tests/cases/conformance/node/index.mts(80,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. +tests/cases/conformance/node/index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.mts(82,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. +tests/cases/conformance/node/index.mts(83,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. +tests/cases/conformance/node/index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.ts(16,22): 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. +tests/cases/conformance/node/index.ts(17,22): 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. +tests/cases/conformance/node/index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.ts(19,22): 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. +tests/cases/conformance/node/index.ts(20,22): 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. +tests/cases/conformance/node/index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.ts(22,22): 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. +tests/cases/conformance/node/index.ts(23,22): 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. +tests/cases/conformance/node/index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.ts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.ts(76,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. +tests/cases/conformance/node/index.ts(77,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. +tests/cases/conformance/node/index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.ts(79,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. +tests/cases/conformance/node/index.ts(80,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. +tests/cases/conformance/node/index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.ts(82,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. +tests/cases/conformance/node/index.ts(83,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. +tests/cases/conformance/node/index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? ==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ==== @@ -136,34 +136,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -228,34 +228,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; @@ -372,34 +372,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; @@ -422,34 +422,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -514,34 +514,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModules1(module=nodenext).errors.txt index 6398640a86946..724e3b73ed7b2 100644 --- a/tests/baselines/reference/nodeModules1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModules1(module=nodenext).errors.txt @@ -15,70 +15,70 @@ tests/cases/conformance/node/index.cts(59,22): error TS1471: Module './subfolder tests/cases/conformance/node/index.cts(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.cts(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(76,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(77,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(78,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(79,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(80,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(81,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(82,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(83,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(84,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.cts(85,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.cts(77,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. +tests/cases/conformance/node/index.cts(78,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. +tests/cases/conformance/node/index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.cts(80,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. +tests/cases/conformance/node/index.cts(81,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. +tests/cases/conformance/node/index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.cts(83,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. +tests/cases/conformance/node/index.cts(84,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. +tests/cases/conformance/node/index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.mts(16,22): 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. +tests/cases/conformance/node/index.mts(17,22): 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. +tests/cases/conformance/node/index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.mts(19,22): 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. +tests/cases/conformance/node/index.mts(20,22): 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. +tests/cases/conformance/node/index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.mts(22,22): 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. +tests/cases/conformance/node/index.mts(23,22): 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. +tests/cases/conformance/node/index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.mts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.mts(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.mts(76,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. +tests/cases/conformance/node/index.mts(77,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. +tests/cases/conformance/node/index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.mts(79,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. +tests/cases/conformance/node/index.mts(80,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. +tests/cases/conformance/node/index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.mts(82,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. +tests/cases/conformance/node/index.mts(83,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. +tests/cases/conformance/node/index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.ts(16,22): 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. +tests/cases/conformance/node/index.ts(17,22): 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. +tests/cases/conformance/node/index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.ts(19,22): 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. +tests/cases/conformance/node/index.ts(20,22): 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. +tests/cases/conformance/node/index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.ts(22,22): 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. +tests/cases/conformance/node/index.ts(23,22): 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. +tests/cases/conformance/node/index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/index.ts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/index.ts(76,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. +tests/cases/conformance/node/index.ts(77,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. +tests/cases/conformance/node/index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/index.ts(79,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. +tests/cases/conformance/node/index.ts(80,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. +tests/cases/conformance/node/index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/index.ts(82,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. +tests/cases/conformance/node/index.ts(83,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. +tests/cases/conformance/node/index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? ==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ==== @@ -136,34 +136,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -228,34 +228,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; @@ -372,34 +372,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; @@ -422,34 +422,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -514,34 +514,34 @@ tests/cases/conformance/node/index.ts(84,21): error TS2307: Cannot find module ' !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).errors.txt b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).errors.txt index 099485a317c49..178c28ed46004 100644 --- a/tests/baselines/reference/nodeModulesAllowJs1(module=node12).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node12).errors.txt @@ -26,27 +26,27 @@ tests/cases/conformance/node/allowJs/index.cjs(60,22): error TS1471: Module './s tests/cases/conformance/node/allowJs/index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(76,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(77,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(78,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(79,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(80,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(81,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(82,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(83,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(84,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(85,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.cjs(77,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. +tests/cases/conformance/node/allowJs/index.cjs(78,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. +tests/cases/conformance/node/allowJs/index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.cjs(80,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. +tests/cases/conformance/node/allowJs/index.cjs(81,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. +tests/cases/conformance/node/allowJs/index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.cjs(83,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. +tests/cases/conformance/node/allowJs/index.cjs(84,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. +tests/cases/conformance/node/allowJs/index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.js(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.js(16,22): 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. +tests/cases/conformance/node/allowJs/index.js(17,22): 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. +tests/cases/conformance/node/allowJs/index.js(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(19,22): 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. +tests/cases/conformance/node/allowJs/index.js(20,22): 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. +tests/cases/conformance/node/allowJs/index.js(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(22,22): 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. +tests/cases/conformance/node/allowJs/index.js(23,22): 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. +tests/cases/conformance/node/allowJs/index.js(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -64,27 +64,27 @@ tests/cases/conformance/node/allowJs/index.js(59,22): error TS1471: Module './su tests/cases/conformance/node/allowJs/index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.js(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.js(76,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. +tests/cases/conformance/node/allowJs/index.js(77,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. +tests/cases/conformance/node/allowJs/index.js(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(79,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. +tests/cases/conformance/node/allowJs/index.js(80,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. +tests/cases/conformance/node/allowJs/index.js(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(82,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. +tests/cases/conformance/node/allowJs/index.js(83,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. +tests/cases/conformance/node/allowJs/index.js(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(16,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(17,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(19,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(20,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(22,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(23,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -102,16 +102,16 @@ tests/cases/conformance/node/allowJs/index.mjs(59,22): error TS1471: Module './s tests/cases/conformance/node/allowJs/index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(76,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. +tests/cases/conformance/node/allowJs/index.mjs(77,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. +tests/cases/conformance/node/allowJs/index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(79,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. +tests/cases/conformance/node/allowJs/index.mjs(80,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. +tests/cases/conformance/node/allowJs/index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(82,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. +tests/cases/conformance/node/allowJs/index.mjs(83,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. +tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? ==== tests/cases/conformance/node/allowJs/subfolder/index.js (0 errors) ==== @@ -169,34 +169,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -283,34 +283,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; @@ -448,34 +448,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; @@ -498,34 +498,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -612,34 +612,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).errors.txt index 099485a317c49..178c28ed46004 100644 --- a/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=nodenext).errors.txt @@ -26,27 +26,27 @@ tests/cases/conformance/node/allowJs/index.cjs(60,22): error TS1471: Module './s tests/cases/conformance/node/allowJs/index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(76,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(77,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(78,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(79,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(80,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(81,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(82,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(83,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(84,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.cjs(85,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.cjs(77,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. +tests/cases/conformance/node/allowJs/index.cjs(78,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. +tests/cases/conformance/node/allowJs/index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.cjs(80,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. +tests/cases/conformance/node/allowJs/index.cjs(81,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. +tests/cases/conformance/node/allowJs/index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.cjs(83,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. +tests/cases/conformance/node/allowJs/index.cjs(84,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. +tests/cases/conformance/node/allowJs/index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.js(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.js(16,22): 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. +tests/cases/conformance/node/allowJs/index.js(17,22): 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. +tests/cases/conformance/node/allowJs/index.js(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(19,22): 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. +tests/cases/conformance/node/allowJs/index.js(20,22): 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. +tests/cases/conformance/node/allowJs/index.js(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(22,22): 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. +tests/cases/conformance/node/allowJs/index.js(23,22): 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. +tests/cases/conformance/node/allowJs/index.js(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -64,27 +64,27 @@ tests/cases/conformance/node/allowJs/index.js(59,22): error TS1471: Module './su tests/cases/conformance/node/allowJs/index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.js(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.js(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.js(76,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. +tests/cases/conformance/node/allowJs/index.js(77,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. +tests/cases/conformance/node/allowJs/index.js(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(79,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. +tests/cases/conformance/node/allowJs/index.js(80,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. +tests/cases/conformance/node/allowJs/index.js(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.js(82,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. +tests/cases/conformance/node/allowJs/index.js(83,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. +tests/cases/conformance/node/allowJs/index.js(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(15,22): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(16,22): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(17,22): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(18,22): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(19,22): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(20,22): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(21,22): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(22,22): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(23,22): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(24,22): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(16,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(17,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(19,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(20,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(22,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(23,22): 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. +tests/cases/conformance/node/allowJs/index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -102,16 +102,16 @@ tests/cases/conformance/node/allowJs/index.mjs(59,22): error TS1471: Module './s tests/cases/conformance/node/allowJs/index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead. tests/cases/conformance/node/allowJs/index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(75,21): error TS2307: Cannot find module './index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(76,21): error TS2307: Cannot find module './subfolder' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(77,21): error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(78,21): error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(79,21): error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(80,21): error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(81,21): error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(82,21): error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(83,21): error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. -tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +tests/cases/conformance/node/allowJs/index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(76,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. +tests/cases/conformance/node/allowJs/index.mjs(77,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. +tests/cases/conformance/node/allowJs/index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(79,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. +tests/cases/conformance/node/allowJs/index.mjs(80,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. +tests/cases/conformance/node/allowJs/index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +tests/cases/conformance/node/allowJs/index.mjs(82,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. +tests/cases/conformance/node/allowJs/index.mjs(83,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. +tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? ==== tests/cases/conformance/node/allowJs/subfolder/index.js (0 errors) ==== @@ -169,34 +169,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -283,34 +283,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; @@ -448,34 +448,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; @@ -498,34 +498,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -612,34 +612,34 @@ tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2307: Cannot find !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ -!!! error TS2307: Cannot find module './index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder' or its corresponding type declarations. +!!! 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. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/' or its corresponding type declarations. +!!! 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. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2' or its corresponding type declarations. +!!! 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. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/' or its corresponding type declarations. +!!! 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. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another' or its corresponding type declarations. +!!! 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. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/' or its corresponding type declarations. +!!! 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. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module './subfolder2/another/index' or its corresponding type declarations. +!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts new file mode 100644 index 0000000000000..83e86fc6c6069 --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension1.ts @@ -0,0 +1,12 @@ +// @moduleResolution: node12 +// @module: node12 + +// @filename: /src/foo.mts +export function foo() { + return ""; +} + +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".mjs" +import { baz } from "./baz"; // should error, ask for extension, no extension suggestion diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension2.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension2.ts new file mode 100644 index 0000000000000..0051e17401c7c --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension2.ts @@ -0,0 +1,6 @@ +// @moduleResolution: node12 +// @module: node12 + +// @filename: /src/buzz.mts +// Extensionless relative path cjs import in an ES module +import foo = require("./foo"); // should error, should not ask for extension \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts new file mode 100644 index 0000000000000..2ec3ff1ad0116 --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension3.ts @@ -0,0 +1,12 @@ +// @moduleResolution: nodenext +// @module: nodenext +// @jsx: preserve + +// @filename: /src/foo.tsx +export function foo() { + return ""; +} + +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".jsx" diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts new file mode 100644 index 0000000000000..c1eab70f92d82 --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension4.ts @@ -0,0 +1,12 @@ +// @moduleResolution: nodenext +// @module: nodenext +// @jsx: react + +// @filename: /src/foo.tsx +export function foo() { + return ""; +} + +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +import { foo } from "./foo"; // should error, suggest adding ".js" diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension5.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension5.ts new file mode 100644 index 0000000000000..5053a242cd5d5 --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension5.ts @@ -0,0 +1,6 @@ +// @moduleResolution: node12 +// @module: node12 + +// @filename: /src/buzz.mts +// Extensionless relative path dynamic import in an ES module +import("./foo").then(x => x); // should error, ask for extension \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension6.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension6.ts new file mode 100644 index 0000000000000..2a6ef2645dd4d --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension6.ts @@ -0,0 +1,8 @@ +// @moduleResolution: node12 +// @module: node12 + +// @filename: /src/bar.cts +// Extensionless relative path import statement in a cjs module +// Import statements are not allowed in cjs files, +// but other errors should not assume that they are allowed +import { foo } from "./foo"; // should error, should not ask for extension \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension7.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension7.ts new file mode 100644 index 0000000000000..3b10dd6e48aab --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension7.ts @@ -0,0 +1,6 @@ +// @moduleResolution: node12 +// @module: node12 + +// @filename: /src/bar.cts +// Extensionless relative path cjs import in a cjs module +import foo = require("./foo"); // should error, should not ask for extension \ No newline at end of file diff --git a/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension8.ts b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension8.ts new file mode 100644 index 0000000000000..fef17b3aa1e54 --- /dev/null +++ b/tests/cases/conformance/externalModules/moduleResolutionWithoutExtension8.ts @@ -0,0 +1,6 @@ +// @moduleResolution: node12 +// @module: node12 + +// @filename: /src/bar.cts +// Extensionless relative path dynamic import in a cjs module +import("./foo").then(x => x); // should error, ask for extension \ No newline at end of file