Escape unique-symbol names in TS4094 diagnostics - #64027
Open
Xia Chao (bun-unsafe) wants to merge 2 commits into
Open
Escape unique-symbol names in TS4094 diagnostics#64027Xia Chao (bun-unsafe) wants to merge 2 commits into
Xia Chao (bun-unsafe) wants to merge 2 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
Pull request overview
Escapes internal unique-symbol names in TS4094 diagnostics.
Changes:
- Applies
EscapeInternalSymbolNamebefore 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.
| ) | ||
|
|
||
| // TS4094 for unique-symbol private names must print the escaped "__@…" form, not the "\xFE" sentinel. | ||
| func TestTS4094EscapesInternalUniqueSymbolName(t *testing.T) { |
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.
TS4094 for a unique-symbol private property on an exported anonymous class printed the internal
"\xFE"sentinel (�@brand@1) instead of the escaped__@brand@1form Strada uses.getNameOfSymbolAsWrittenalready callsEscapeInternalSymbolName. This path reportedpropertySymbol.Nameraw. Private#names are unchanged (SymbolName).This does not change declaration emit of
export defaultunnameable 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.