We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fc906e commit 36a82c7Copy full SHA for 36a82c7
1 file changed
src/compiler/utilities.ts
@@ -232,8 +232,8 @@ namespace ts {
232
233
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
234
export function escapeIdentifier(identifier: string): string {
235
- const prefixWithUnderscore = identifier.length > 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._;
236
- return prefixWithUnderscore ? "_" + identifier : identifier;
+ const prefixedWithUnderscores = identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._;
+ return prefixedWithUnderscores ? "_" + identifier : identifier;
237
}
238
239
// Remove extra underscore from escaped identifier
0 commit comments