Treat the input file name from referenced project as "ts" rather than file extension it is when determining eliding file for program construction (#58308)

This commit is contained in:
Sheetal Nandi
2024-04-26 13:15:02 -07:00
committed by GitHub
parent c92bd16ac0
commit 95d23ca7d2
4 changed files with 595 additions and 1 deletions
+2 -1
View File
@@ -4106,7 +4106,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
}
const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension);
// If this is js file source of project reference, dont treat it as js file but as d.ts
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension) && !getProjectReferenceRedirectProject(resolution.resolvedFileName);
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
const resolvedFileName = resolution.resolvedFileName;