Skip to content

Commit

Permalink
feat: prevent transform dynamic arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyuanzmj committed Dec 26, 2024
1 parent a0791ae commit a025e3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ function transformReactivityFunction(
} else if (
node.type === 'JSXAttribute' &&
node.value?.type === 'JSXExpressionContainer' &&
s.sliceNode(node.name).endsWith('$')
s.sliceNode(node.name).endsWith('$') &&
!s.sliceNode(node.name).includes(':$')
) {
s.remove(node.name.end! - 1, node.name.end!)
if (node.value.expression) {
Expand Down
3 changes: 2 additions & 1 deletion src/volar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ function transform({
node.initializer &&
ts.isJsxExpression(node.initializer) &&
node.initializer.expression &&
getText(node.name, ast, ts).endsWith('$')
getText(node.name, ast, ts).endsWith('$') &&
!getText(node.name, ast, ts).includes(':$')
) {
replaceSourceRange(codes, source, node.name.end - 1, node.name.end)
replaceSourceRange(
Expand Down

0 comments on commit a025e3b

Please sign in to comment.