Skip to content

Commit b499a03

Browse files
author
Kanchalai Tanglertsampan
committed
Address PR
1 parent 540ae01 commit b499a03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ namespace ts {
232232

233233
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
234234
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;
235+
const prefixedWithUnderscores = identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._;
236+
return prefixedWithUnderscores ? "_" + identifier : identifier;
237237
}
238238

239239
// Remove extra underscore from escaped identifier

0 commit comments

Comments
 (0)