Skip to content

Don't emit redundant and invalid extra renamed keyword exports in JS files - #62104

Closed
Mateusz Burzyński (Andarist) wants to merge 2 commits into
microsoft:mainfrom
Andarist:fix/invalid-keyword-extra-export-in-js
Closed

Don't emit redundant and invalid extra renamed keyword exports in JS files#62104
Mateusz Burzyński (Andarist) wants to merge 2 commits into
microsoft:mainfrom
Andarist:fix/invalid-keyword-extra-export-in-js

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings July 22, 2025 08:31
@github-project-automationgithub-project-automationBot moved this to Not started in PR BacklogJul 22, 2025
@typescript-botTypeScript Bot (typescript-bot) added For Backlog Bug PRs that fix a backlog bug labels Jul 22, 2025

CopilotAI 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.

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
FileDescription
jsDeclarationsKeywordExport1.tsTest case demonstrating exports with keyword names (null, void)
jsDeclarationsKeywordExport1.typesExpected type output for the test case
jsDeclarationsKeywordExport1.symbolsExpected symbol resolution for the test case
jsDeclarationsKeywordExport1.jsExpected compiled output including declaration file
checker.tsCore fix removing redundant export declaration generation logic
Comments suppressed due to low confidence (1)

context.approximateLength += 16 + internalSymbolName.length; // `export default internalName;`
addResult(factory.createExportAssignment(/*modifiers*/ undefined, /*isExportEquals*/ false, factory.createIdentifier(internalSymbolName)), ModifierFlags.None);
}
else if (needsExportDeclaration) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

this was originally added by Wesley Wigham (@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

@typescript-bot

Copy link
Copy Markdown
Contributor

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

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

Labels

For Backlog BugPRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

export { _void as void } leads to exporting duplicate identifiers

4 participants

@Andarist@typescript-bot@RyanCavanaugh