Skip to content

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

Merged
Sheetal Nandi (sheetalkamat) merged 1 commit into
masterfrom
scopedPackages
Dec 20, 2019
Merged

Sheetal Nandi (sheetalkamat) merged 1 commit into
masterfrom
scopedPackages

Conversation

@sheetalkamat

Copy link
Copy Markdown
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
Sheetal Nandi (sheetalkamat) deleted the scopedPackages branch December 20, 2019 15:44
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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