diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 500eddd9f773e..3381bd7e839e0 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1755,8 +1755,6 @@ function loadModuleFromFile(extensions: Extensions, candidate: string, onlyRecor return resolvedByAddingExtension; } } - - return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state); } function loadModuleFromFileNoImplicitExtensions(extensions: Extensions, candidate: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PathAndExtension | undefined { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9663407956ac2..8cc9aaec0f2db 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7224,7 +7224,7 @@ export interface ResolvedModule { * True if the original module reference used a .ts extension to refer directly to a .ts file, * which should produce an error during checking if emit is enabled. */ - resolvedUsingTsExtension: boolean; + resolvedUsingTsExtension?: boolean; } /** diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 8b9326b0a3ed7..5ae7ebee71e56 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -169,7 +169,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/sub/node_modules/a/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -185,7 +184,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/sub/directory/node_modules/b/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -203,7 +201,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/bar/node_modules/c/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -220,7 +217,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/foo/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -236,7 +232,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "d:/bar/node_modules/e/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json index cc002fa3d6f25..a2521c7f7395f 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json @@ -19,10 +19,6 @@ "File '/node_modules/foo/foo.js.ts' does not exist.", "File '/node_modules/foo/foo.js.tsx' does not exist.", "File '/node_modules/foo/foo.js.d.ts' does not exist.", - "File name '/node_modules/foo/foo.js' has a '.js' extension - stripping it.", - "File '/node_modules/foo/foo.ts' does not exist.", - "File '/node_modules/foo/foo.tsx' does not exist.", - "File '/node_modules/foo/foo.d.ts' does not exist.", "Directory '/node_modules/foo/foo.js' does not exist, skipping all lookups in it.", "File '/node_modules/foo/index.ts' does not exist.", "File '/node_modules/foo/index.tsx' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json index a63b584c81558..f1472c7f4c459 100644 --- a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json @@ -9,10 +9,6 @@ "File '/foo.js.ios.ts' does not exist.", "File '/foo.js.ios.tsx' does not exist.", "File '/foo.js.ios.d.ts' does not exist.", - "File name '/foo.js' has a '.js' extension - stripping it.", - "File '/foo.ios.ts' does not exist.", - "File '/foo.ios.tsx' does not exist.", - "File '/foo.ios.d.ts' does not exist.", "Directory '/foo.js' does not exist, skipping all lookups in it.", "Loading module as file / folder, candidate module location '/foo.js', target file types: JavaScript.", "File name '/foo.js' has a '.js' extension - stripping it.", diff --git a/tests/baselines/reference/packageJsonMain.trace.json b/tests/baselines/reference/packageJsonMain.trace.json index ad862538465f5..0b4ae83be9631 100644 --- a/tests/baselines/reference/packageJsonMain.trace.json +++ b/tests/baselines/reference/packageJsonMain.trace.json @@ -51,10 +51,6 @@ "File '/node_modules/bar/rab.js.ts' does not exist.", "File '/node_modules/bar/rab.js.tsx' does not exist.", "File '/node_modules/bar/rab.js.d.ts' does not exist.", - "File name '/node_modules/bar/rab.js' has a '.js' extension - stripping it.", - "File '/node_modules/bar/rab.ts' does not exist.", - "File '/node_modules/bar/rab.tsx' does not exist.", - "File '/node_modules/bar/rab.d.ts' does not exist.", "Directory '/node_modules/bar/rab.js' does not exist, skipping all lookups in it.", "File '/node_modules/bar/index.ts' does not exist.", "File '/node_modules/bar/index.tsx' does not exist.", diff --git a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js index af4b7b9ece81c..3d8b1ff5b569d 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js @@ -50,10 +50,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Failed Lookup Locations @@ -169,10 +165,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -276,10 +268,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== File '/a/lib/package.json' does not exist according to earlier cached lookups. @@ -390,10 +378,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations diff --git a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js index 1e5a35c06ecfc..688ac828dc9f7 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js @@ -55,10 +55,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -175,10 +171,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== File '/a/lib/package.json' does not exist according to earlier cached lookups. @@ -283,10 +275,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -482,10 +470,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== File '/a/lib/package.json' does not exist according to earlier cached lookups. @@ -597,10 +581,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations