Repository navigation
Correctly set filesByName map when reusing program to ensure it is same as old program - #35784
Merged
Merged
Conversation
…me as old It was previously not populated correctly if preserveSymlinks with useSourceOfProjectReference was true, in that case if module was resolved to symlink and we deduced it refers to source of project reference we want to set "resolvedFileName" correctly otherwise it results in incorrect module not found errors.
Sheetal Nandi (sheetalkamat)
requested review from
Ryan Cavanaugh (RyanCavanaugh),
Andrew Casey (amcasey),
Andrew Branch (andrewbranch),
Eli Barzilay (elibarzilay),
Gabriela Araujo Britto (gabritto),
Orta Therox (orta),
Ron Buckton (rbuckton),
Nathan Shively-Sanders (sandersn) and
Wesley Wigham (weswigham)
December 19, 2019 21:15
Andrew Branch (andrewbranch)
approved these changes
Dec 20, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously we were setting these with each new sourceFile's
pathandresolvedPathbut that's not enough.Eg. if its monorepo like setup and we are using sourceOfProjectReferenceRedirect with preserveSymlinks, we would get resolvedFileName of the moduleResolution as
node_modules/projectName/someFile.d.tsand when creating new program without reusing old program, we would find that this is actually link to saysrc/someFile.tsin referenced project and use that source file. So in that program we have entries forprojectName/src/someFile.ts,projectName/lib/someFile.d.tsas well asnode_modules/projectName/someFile.d.tsall pointing tosomeFile.tssourceFile.In new program that uses old program previously we would only set
projectName/src/someFile.ts,projectName/lib/someFile.d.tsto point to the sourceFile ofsomeFile.tsand hence in checker we would incorrectly think that module resolution has failed and report the error.Fixes #35768