Skip to content

Commit 10a4557

Browse files
committed
feat: supports more typescript expression
1 parent da991bc commit 10a4557

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/core/convert.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ function transformJsx(code: string, node: JSX) {
251251
)
252252
return expressions.slice(-1)[0]
253253
}
254-
case 'TSNonNullExpression':
254+
case 'ParenthesizedExpression': // (1)
255+
case 'TSNonNullExpression': // 1!
256+
case 'TSAsExpression': // 1 as number
257+
case 'TSTypeAssertion': // (<number>2)
258+
case 'TSInstantiationExpression': // '1'<string>
255259
return resolveExpression(node.expression, node)
256260
case 'CallExpression':
257261
return resolveCallExpression(node, !parent)

0 commit comments

Comments
 (0)