Skip to content

Invalidate declaration state when linked packages change - #64841

Open
Adarsh (jackeddisciple) wants to merge 1 commit into
microsoft:mainfrom
jackeddisciple:fix-linked-package-dts-state
Open

Adarsh (jackeddisciple) wants to merge 1 commit into
microsoft:mainfrom
jackeddisciple:fix-linked-package-dts-state

Conversation

@jackeddisciple

Copy link
Copy Markdown

Fixes #64838

Incremental builds kept old declaration diagnostics and skipped d.ts emit for unchanged files even when the package links behind declaration module specifiers had changed, so tsc -b could disagree with tsc -b --force.

The snapshot now stores a signature of the program's symlinked package directories plus each linked package's entry fields (type, main, types, typings, typesVersions, exports), written to tsbuildinfo with paths relative to it. When the signature changes, every file gets its declaration emit queued again, the same way an emit affecting option change does. Dependency names show up through the links they resolve, and edits like a version bump leave the signature alone, so they don't trigger another emit. Unchanged d.ts text still skips the write, so downstream projects don't churn.

JSONValue gets a MarshalJSONTo so exports and typesVersions can be serialized for the signature.

Tests cover adding and removing a linked dependency, declaring a dependency on an existing link, and a linked package's types entry moving under tsc -b, plus tsc --incremental and watch. Three existing baselines just pick up the new tsbuildinfo field.

Not covered here: with --build, a link change with no manifest edit still doesn't mark the project out of date. That's the existing up to date check, which misses link only changes for module resolution too, so it seemed better as a separate change.

I used Claude Code while working on this and reviewed the changes.

@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 16, 2026
Copilot AI balanced review requested due to automatic review settings October 16, 2026 07:05
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

@jackeddisciple

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Incremental tsc --build reports a different result from a clean build after a change to package.json dependencies

2 participants