Repository navigation
fix(65682): preserve export bindings in commonjs postfix updates - #65701
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 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/vardeclarations. - 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
Jake Bailey (jakebailey)
approved these changes
Nov 26, 2026
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 #65682