Skip to content

fix(65682): preserve export bindings in commonjs postfix updates - #65701

Merged
Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
a-tarasyuk:fix/65682
Nov 26, 2026
Merged

Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
a-tarasyuk:fix/65682

Conversation

@a-tarasyuk

Copy link
Copy Markdown
Contributor

Fixes #65682

Copilot AI balanced review requested due to automatic review settings November 26, 2026 18:20
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 26, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 26, 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

No active review issues are reported for the change addressing CommonJS postfix updates on aliased exports.

No open issues 🎉

What changed in this PR

Fixes #65682 by correcting the compiler’s CommonJS output for postfix updates on exported variables with alias exports, preventing references to nonexistent local bindings.

Changes:

  • Visits the cloned postfix operand so exported references are rewritten correctly.
  • Adds regression cases for increment/decrement, multiple alias forms, and exported let/var declarations.
  • Updates JavaScript, type, and symbol baselines.
File Description
tsc/​testdata/​tests/​cases/​compiler/​moduleExportsUnaryExpression.ts Adds postfix-update regression cases.
tsc/​testdata/​baselines/​reference/​compiler/​moduleExportsUnaryExpression.types Records types for the added cases.
tsc/​testdata/​baselines/​reference/​compiler/​moduleExportsUnaryExpression.symbols Records symbols for the added cases.
tsc/​testdata/​baselines/​reference/​compiler/​moduleExportsUnaryExpression.js Captures corrected export references and alias updates.
tsc/​internal/​transformers/​moduletransforms/​commonjsmodule.go Visits the cloned operand to preserve export bindings.

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Nov 26, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Nov 26, 2026
Merged via the queue into microsoft:main with commit 6327ae1 Nov 26, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Nov 26, 2026
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: Done

Development

Successfully merging this pull request may close these issues.

Regression from 6.0: CommonJS emit throws ReferenceError for x++ / x-- on an export let that also has an alias export

3 participants