Skip to content

Commit

Permalink
fix: also apply on class private property
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Mar 24, 2022
1 parent 8e002ca commit b7a34d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/babel-helper-environment-visitor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export function skipAllButComputedKey(
}

function skipAndrequeueComputedKeysAndDecorators(
path: NodePath<t.Method | t.ClassProperty>,
path: NodePath<t.Method | t.Property>,
) {
path.skip();
const { context } = path;
//@ts-ignore ClassPrivateProperty does not have computed
if (path.node.computed) {
// requeue the computed key
context.maybeQueue(path.get("key"));
Expand All @@ -43,7 +44,9 @@ export default {
path.skip();
}
},
ClassProperty(path) {
"ClassProperty|ClassPrivateProperty"(
path: NodePath<t.ClassProperty | t.ClassPrivateProperty>,
) {
skipAndrequeueComputedKeysAndDecorators(path);
},
} as Visitor<unknown>;

0 comments on commit b7a34d5

Please sign in to comment.