Skip to content

Commit 09b6474

Browse files
committedJan 14, 2025··
fix: prefix PrivateIdentifier names with a # (#921)
BREAKING CHANGE: when using patterns to match against PrivateIdentifiers, their names are now prefixed with a #. fix #910 fix #911
1 parent 3999418 commit 09b6474

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/utils/misc.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ function getNodeIdentifierText(
5353

5454
let mut_identifierText: string | undefined | null = null;
5555

56-
if (isIdentifier(node) || isPrivateIdentifier(node)) {
56+
if (isIdentifier(node)) {
5757
mut_identifierText = node.name;
58+
} else if (isPrivateIdentifier(node)) {
59+
mut_identifierText = `#${node.name}`;
5860
} else if (hasID(node) && isDefined(node.id)) {
5961
mut_identifierText = getNodeIdentifierText(node.id, context);
6062
} else if (hasKey(node) && isDefined(node.key)) {

0 commit comments

Comments
 (0)
Please sign in to comment.