Skip to content

Keep computed-name reconstruction out of symbol tracking - #64208

Open
Jake Bailey (jakebailey) wants to merge 2 commits into
microsoft:mainfrom
jakebailey:fix-declaration-emit-visibility
Open

Keep computed-name reconstruction out of symbol tracking#64208
Jake Bailey (jakebailey) wants to merge 2 commits into
microsoft:mainfrom
jakebailey:fix-declaration-emit-visibility

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This should be the actual fix for the problem I tried to fix in #63986.

The first commit has a test which shows the bad behavior consistently, the second fixes it.

Record declaration emit retaining an otherwise unused namespace after
serializing a computed property from another file. The referenced type
is stripped, so the namespace should not survive in declaration output.
Computed property references are already checked in the destination
scope. Reconstructing their source spelling must not track a second
reference in the source scope, which could paint declarations visible
for another file's emitter.

Separate expression construction from reference tracking and use the
untracked path when reconstructing computed names. Update the regression
baseline so the otherwise unused namespace is no longer emitted.
Copilot AI balanced review requested due to automatic review settings September 9, 2026 00:11
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 9, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 9, 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.

🟢 Approval recommended

The tracking change is narrowly scoped and the regression baselines verify the corrected declaration visibility behavior.

Pull request overview

Prevents computed-name reconstruction from incorrectly marking source-scope declarations as visible during declaration emit.

Changes:

  • Separates symbol tracking from expression reconstruction.
  • Adds a regression test for cross-file computed names with stripInternal.
  • Adds expected diagnostic, emit, type, and symbol baselines.
File summaries
File Description
tsc/internal/checker/nodebuilderimpl.go Uses untracked reconstruction for computed property names.
tsc/testdata/tests/cases/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.ts Adds the regression scenario.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.js Records declaration output.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.errors.txt Records the expected diagnostic.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.symbols Records symbol information.
tsc/testdata/baselines/reference/compiler/declarationEmitComputedPropertyNameSymbolStripInternal.types Records inferred types.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

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

Labels

Author: Team 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.

2 participants