diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index e40029ff6fe..be1a09548fa 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -86,7 +86,14 @@ namespace ts { return { fileName: resolved.path, packageId: resolved.packageId }; } - function createResolvedModuleWithFailedLookupLocations(resolved: Resolved | undefined, isExternalLibraryImport: boolean | undefined, failedLookupLocations: string[], affectingLocations: string[], diagnostics: Diagnostic[], resultFromCache: ResolvedModuleWithFailedLookupLocations | undefined): ResolvedModuleWithFailedLookupLocations { + function createResolvedModuleWithFailedLookupLocations( + resolved: Resolved | undefined, + isExternalLibraryImport: boolean | undefined, + failedLookupLocations: string[], + affectingLocations: string[], + diagnostics: Diagnostic[], + resultFromCache: ResolvedModuleWithFailedLookupLocations | undefined + ): ResolvedModuleWithFailedLookupLocations { if (resultFromCache) { resultFromCache.failedLookupLocations.push(...failedLookupLocations); resultFromCache.affectingLocations.push(...affectingLocations); @@ -2578,8 +2585,7 @@ namespace ts { host, traceEnabled, failedLookupLocations, - affectingLocations, - packageJsonInfoCache: cache, + affectingLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: containingDirectory, @@ -2652,7 +2658,7 @@ namespace ts { features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: undefined, - reportDiagnostic: diag => void diagnostics.push(diag) + reportDiagnostic: diag => void diagnostics.push(diag), }; const resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined); return createResolvedModuleWithFailedLookupLocations( diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 08362cdfce2..df2179cba77 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6768,7 +6768,7 @@ namespace ts { readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined; readonly failedLookupLocations: string[]; /*@internal*/ readonly affectingLocations: string[]; - /* @internal */ readonly resolutionDiagnostics: Diagnostic[] + /* @internal */ resolutionDiagnostics: Diagnostic[]; } /* @internal */ diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 5aab2367b6c..1f85f97827c 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -141,7 +141,7 @@ namespace ts { checkResolvedModule(resolution.resolvedModule, createResolvedModule(moduleFile.name)); // expect three failed lookup location - attempt to load module as file with all supported extensions assert.equal(resolution.failedLookupLocations.length, supportedTSExtensions[0].length); - // TODO + assert.deepEqual(resolution.affectingLocations, [packageJsonFileName]); } }