Don't emit redundant and invalid extra renamed keyword exports in JS files#62104
Open
Andarist wants to merge 2 commits intomicrosoft:mainfrom
Open
Don't emit redundant and invalid extra renamed keyword exports in JS files#62104Andarist wants to merge 2 commits intomicrosoft:mainfrom
Andarist wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the issue where TypeScript was emitting redundant and invalid extra renamed keyword exports in JavaScript declaration files. The change addresses a bug where exports using JavaScript keywords as export names (like export { _null as null }) were generating unnecessary additional export declarations.
- Removes logic that created redundant export declarations for keyword exports
- Simplifies the private symbol handling logic by using logical OR assignment
- Cleans up unnecessary variable tracking for export declarations
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| jsDeclarationsKeywordExport1.ts | Test case demonstrating exports with keyword names (null, void) |
| jsDeclarationsKeywordExport1.types | Expected type output for the test case |
| jsDeclarationsKeywordExport1.symbols | Expected symbol resolution for the test case |
| jsDeclarationsKeywordExport1.js | Expected compiled output including declaration file |
| checker.ts | Core fix removing redundant export declaration generation logic |
Comments suppressed due to low confidence (1)
Andarist
commented
Jul 22, 2025
| context.approximateLength += 16 + internalSymbolName.length; // `export default internalName;` | ||
| addResult(factory.createExportAssignment(/*modifiers*/ undefined, /*isExportEquals*/ false, factory.createIdentifier(internalSymbolName)), ModifierFlags.None); | ||
| } | ||
| else if (needsExportDeclaration) { |
Contributor
Author
There was a problem hiding this comment.
this was originally added by @weswigham in #38982
I tried to think of a potential missing test case, but I couldn't find one. Perhaps this just became handled by other code paths since this was introduced
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 #62081
cc @weswigham @sandersn