Skip to content

Escape unique-symbol names in TS4094 diagnostics - #64027

Open
Xia Chao (bun-unsafe) wants to merge 1 commit into
microsoft:mainfrom
bun-unsafe:fix/ts4094-escape-internal-symbol
Open

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

Conversation

@bun-unsafe

@bun-unsafe Xia Chao (bun-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) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants