Skip to content

Commit a4bc65b

Browse files
Max Heibermheiber
Max Heiber
authored andcommitted
Move getPropertyNameForUniqueESSymbol to utility
for consistency with other calculation of special property names (starting with __), move the calculation of property names for unique es symbols to `utilities.ts`. Signed-off-by: Max Heiber <[email protected]>
1 parent b5c0933 commit a4bc65b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6252,7 +6252,7 @@ namespace ts {
62526252
*/
62536253
function getLateBoundNameFromType(type: LiteralType | UniqueESSymbolType): __String {
62546254
if (type.flags & TypeFlags.UniqueESSymbol) {
6255-
return `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}` as __String;
6255+
return getPropertyNameForUniqueESSymbol(type.symbol);
62566256
}
62576257
if (type.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) {
62586258
return escapeLeadingUnderscores("" + (<LiteralType>type).value);

src/compiler/utilities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,6 +2728,10 @@ namespace ts {
27282728
return node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.PrivateName ? node.escapedText : escapeLeadingUnderscores(node.text);
27292729
}
27302730

2731+
export function getPropertyNameForUniqueESSymbol(symbol: Symbol): __String {
2732+
return `__@${getSymbolId(symbol)}@${symbol.escapedName}` as __String;
2733+
}
2734+
27312735
export function getPropertyNameForKnownSymbolName(symbolName: string): __String {
27322736
return "__@" + symbolName as __String;
27332737
}

0 commit comments

Comments
 (0)