Skip to content

Escape unique-symbol names in TS4094 diagnostics - #64027

Closed
Xia Chao (javascript-unsafe) wants to merge 5 commits into
microsoft:mainfrom
javascript-unsafe:fix/ts4094-escape-internal-symbol
Closed

Escape unique-symbol names in TS4094 diagnostics#64027
Xia Chao (javascript-unsafe) wants to merge 5 commits into
microsoft:mainfrom
javascript-unsafe:fix/ts4094-escape-internal-symbol

Conversation

@javascript-unsafe

@javascript-unsafe Xia Chao (javascript-unsafe) commented Aug 26, 2026

Copy link
Copy Markdown

TS4094 for a unique-symbol private property on an exported anonymous class printed the internal "\xFE" sentinel (�@brand@1) instead of the escaped __@brand@1 form Strada uses.

getNameOfSymbolAsWritten already calls EscapeInternalSymbolName. This path reported propertySymbol.Name raw. Private # names are unchanged (SymbolName).

This does not change declaration emit of export default unnameable types (#63761).

Test: TestTS4094EscapesInternalUniqueSymbolName.


I used Copilot while writing this patch. I read the change, ran the test above, and I will handle review myself.

Internal symbol names use a "\xFE" prefix. Reporting propertySymbol.Name
raw put invalid UTF-8 in TS4094; escape it like getNameOfSymbolAsWritten.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI balanced review requested due to automatic review settings August 26, 2026 07:03
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Aug 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.

Pull request overview

Escapes internal unique-symbol names in TS4094 diagnostics.

Changes:

  • Applies EscapeInternalSymbolName before reporting private/protected properties.
  • Adds regression coverage validating UTF-8 and escaped __@brand@ output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tsc/internal/checker/nodebuilderimpl.go Escapes internal property names in TS4094.
tsc/internal/compiler/declaration_emit_ts4094_test.go Tests unique-symbol diagnostic formatting.

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

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

)

// TS4094 for unique-symbol private names must print the escaped "__@…" form, not the "\xFE" sentinel.
func TestTS4094EscapesInternalUniqueSymbolName(t *testing.T) {
Replace the ad hoc Go emit test with a compiler fixture. Strip the
process-global symbol id from the diagnostic name so "__@brand" is stable.

Co-authored-by: Cursor <cursoragent@cursor.com>
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Aug 30, 2026
@typescript-automation

Copy link
Copy Markdown

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@github-project-automation github-project-automation Bot moved this from Not started to Done in PR Backlog Sep 3, 2026
@javascript-unsafe
Xia Chao (javascript-unsafe) deleted the fix/ts4094-escape-internal-symbol branch September 3, 2026 16:23
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.

2 participants