From dfef6abeade7db0891cf0dcc024f690ced9dee1f Mon Sep 17 00:00:00 2001 From: Quramy Date: Sat, 16 Mar 2024 14:49:52 +0900 Subject: [PATCH] fix: Add arguments length check --- src/ts-ast-util/tag-utils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ts-ast-util/tag-utils.ts b/src/ts-ast-util/tag-utils.ts index 573f9247..335ed3c9 100644 --- a/src/ts-ast-util/tag-utils.ts +++ b/src/ts-ast-util/tag-utils.ts @@ -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)) {