Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly set filesByName map when reusing program to ensure it is same as old program #35784

Merged
merged 1 commit into from
Dec 20, 2019

Conversation

sheetalkamat
Copy link
Member

Previously we were setting these with each new sourceFile's path and resolvedPath but 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.ts and when creating new program without reusing old program, we would find that this is actually link to say src/someFile.ts in referenced project and use that source file. So in that program we have entries for projectName/src/someFile.ts, projectName/lib/someFile.d.ts as well as node_modules/projectName/someFile.d.ts all pointing to someFile.ts sourceFile.
In new program that uses old program previously we would only set projectName/src/someFile.ts, projectName/lib/someFile.d.ts to point to the sourceFile of someFile.ts and hence in checker we would incorrectly think that module resolution has failed and report the error.

Fixes #35768

…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.
@sheetalkamat sheetalkamat merged commit 9445657 into master Dec 20, 2019
@sheetalkamat sheetalkamat deleted the scopedPackages branch December 20, 2019 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript 3.7+ regression issue in Lerna monorepo w/ Yarn Workspaces and composite projects
2 participants