Skip to content

Commit

Permalink
Merge pull request #1240 from Quramy/fix_function_tag_detection
Browse files Browse the repository at this point in the history
fix: Add arguments length check
  • Loading branch information
Quramy committed Mar 16, 2024
2 parents 629683b + dfef6ab commit 49aec29
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 49aec29

Please sign in to comment.