Skip to content

Commit

Permalink
Fix transform inconsistency in decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
Fireboltofdeath committed Aug 5, 2023
1 parent 9fc4348 commit 00a34de
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/transformations/statements/transformClassDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,16 @@ function transformDecoratorConfig(
assert(!expr.arguments[0] || f.is.object(expr.arguments[0]));

const baseConfig = expr.arguments[0] ? expr.arguments[0] : f.object([]);
return [f.update.object(baseConfig, updateComponentConfig(state, declaration, [...baseConfig.properties]))];
const componentConfig = updateComponentConfig(state, declaration, [...baseConfig.properties]);
return [
f.update.object(
baseConfig,
componentConfig.map((v) => (baseConfig.properties.includes(v) ? state.transformNode(v) : v)),
),
];
}

return expr.arguments;
return expr.arguments.map((v) => state.transformNode(v));
}

function getDecoratorFields(
Expand Down Expand Up @@ -401,7 +407,10 @@ function updateAttributeGuards(
properties.push(
f.update.propertyAssignmentDeclaration(
attributes,
f.update.object(attributes.initializer, [...attributes.initializer.properties, ...filteredGuards]),
f.update.object(attributes.initializer, [
...attributes.initializer.properties.map((v) => state.transformNode(v)),
...filteredGuards,
]),
attributes.name,
),
);
Expand Down

0 comments on commit 00a34de

Please sign in to comment.