-
Notifications
You must be signed in to change notification settings - Fork 13k
Fix incorrectly ignored dts file from project reference for resolution #62438
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
createProgram
to handle declaration files correctly - Added a new test case to verify that module resolution works correctly from
.d.ts
files 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Copilot uses AI. Check for mistakes.
@typescript-bot cherry-pick this to release-5.9 |
Hey, @jakebailey! I've created #62440 for you. |
Fixes #62434