Microsoft/TypeScript
Auf GitHub ansehenText between Unicode escapes within an identifier is skipped
Open
#61.043 geöffnet am 24. Jan. 2025
BugDomain: ParserHelp Wanted
Repository-Metriken
- Stars
- (48.455 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)
Beschreibung
🔎 Search Terms
- Unicode escape sequences
- extended Unicode escapes
- variables, constants, property names, JSX identifiers, JSX attribute names…
- regular expression group names, RegExp identifiers
- bundling & transpilation
🕗 Version & Regression Information
- This is the behavior since #32725 lands
⏯ Playground Link
💻 Code
const a\u{62}c\u{64}e = 42;
abcde; // Error: Cannot find name 'abcde'. Did you mean 'a\u{62}c\u{64}e'?
abde; // No error
const \u{76}ar\u{69}able = 42;
variable; // Error: Cannot find name 'variable'. Did you mean '\u{76}ar\u{69}able'?
viable; // No error
🙁 Actual behavior
abde and viable are recognised but not abcde and variable.
🙂 Expected behavior
abcde and variable are recognised but not abde and viable.
Additional information about the issue
Precisely, text between a 4-digit or extended Unicode escape and an extended Unicode escape is ignored.
(This is not the case for text between a 4-digit or extended Unicode escape and a 4-digit Unicode escape.)
This happens with all kinds of identifiers, not just variable names, due to the missing line result += text.substring(start, pos);. This issue is opened just for trackability and is fixed in #61042.