Skip to content

Commit

Permalink
fix: Add arguments length check
Browse files Browse the repository at this point in the history
  • Loading branch information
Quramy committed Mar 16, 2024
1 parent 629683b commit dfef6ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ts-ast-util/tag-utils.ts
Expand Up @@ -57,7 +57,12 @@ export function getTemplateNodeUnder(
return node.template;
}
}
if (allowFunctionCallExpression && ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {
if (
allowFunctionCallExpression &&
ts.isCallExpression(node) &&
ts.isIdentifier(node.expression) &&
node.arguments.length > 0
) {
const firstArg = node.arguments[0];
if (!ts.isTemplateLiteral(firstArg)) return;
if (names.includes(node.expression.escapedText as string)) {
Expand Down

0 comments on commit dfef6ab

Please sign in to comment.