Fix incorrectly ignored dts file from project reference for resolution#62438
Merged
sheetalkamat merged 2 commits intomainfrom Sep 11, 2025
Merged
Fix incorrectly ignored dts file from project reference for resolution#62438sheetalkamat merged 2 commits intomainfrom
sheetalkamat merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where .d.ts files from project references were incorrectly ignored during module resolution. The fix modifies the program compilation logic to properly handle declaration files in project references by updating the file processing condition.
Key Changes
- Modified the file processing logic in
createProgramto handle declaration files correctly - Added a new test case to verify that module resolution works correctly from
.d.tsfiles in referenced projects
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/compiler/program.ts |
Updates file processing condition to properly handle declaration files from project references |
src/testRunner/unittests/tsbuild/moduleResolution.ts |
Adds new test case for verifying module resolution from .d.ts files in referenced projects |
tests/baselines/reference/tsbuild/moduleResolution/resolution-from-d.ts-of-referenced-project.js |
Baseline file for the new test case showing expected compilation output and trace resolution |
| const path = toPath(fileName); | ||
| let outputDts; | ||
| if (!fileExtensionIs(fileName, Extension.Json)) { | ||
| if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, Extension.Json)) { |
There was a problem hiding this comment.
[nitpick] The condition logic is now more complex with two negations. Consider extracting this into a helper function with a descriptive name like shouldProcessForOutput to improve readability and make the intent clearer.
jakebailey
approved these changes
Sep 11, 2025
Member
|
@typescript-bot cherry-pick this to release-5.9 |
Collaborator
typescript-bot
pushed a commit
that referenced
this pull request
Sep 11, 2025
Collaborator
|
Hey, @jakebailey! I've created #62440 for you. |
jakebailey
pushed a commit
that referenced
this pull request
Sep 25, 2025
…e-5.9 (#62440) Co-authored-by: Sheetal Nandi <[email protected]>
1 task
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #62434