microsoft / microsoft/TypeScript

Computed property name is not escaped in declaration emit

Offen
#60,819 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@weswigham arbeitet bereits daran.

Seit 02.1.2025.

Bug Domain: Declaration Emit
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔎 Search Terms

computed property symbol declaration emit

🕗 Version & Regression Information
  • This changed between versions 3.7 and 3.8
⏯ Playground Link

https://www.typescriptlang.org/play/?ts=3.7.5#code/MYGwhgzhAEAq0G8BQ1XQgFzBglsaATgKZgAmA9gHYgCe0A2gEQA6GjAugFzQCulOARx5F0NALYAjciADcSAL5IQRDNAAe0ALyIUaerCasOXaAEYFMoA

💻 Code
class T {
    static readonly ["\t"]: unique symbol;
}
let x = {
    [T["\t"]]: 1
};
🙁 Actual behavior

The type of x is emitted as { [T["\t"]]: number; } in declaration files, making the file invalid since the property does not exist on T

🙂 Expected behavior

The escape should be preserved in the property name.

Additional information about the issue

Was introduced by https://github.com/microsoft/TypeScript/pull/18860/commits/8bb7230729f43f1c134f895a535e73c4cd58af3e

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.