From 4e2640be046b1209ac7b3ebd911c6f656364d4df Mon Sep 17 00:00:00 2001 From: Leonid Shevtsov Date: Wed, 1 Nov 2017 22:25:50 +0200 Subject: [PATCH] Avoid error when state.children is a function call (CallExpression) --- ng-annotate-main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ng-annotate-main.js b/ng-annotate-main.js index 11847ee..4746504 100644 --- a/ng-annotate-main.js +++ b/ng-annotate-main.js @@ -218,11 +218,15 @@ function matchNgUi(path) { matchStateProps(properties, res); const childrenArrayExpression = matchProp("children", properties); - const children = childrenArrayExpression && childrenArrayExpression.get("elements"); + if (!childrenArrayExpression || !t.isArrayExpression(childrenArrayExpression)) { + return + } + const children = childrenArrayExpression.get("elements"); if (!children) { return; } + children.forEach(recursiveMatch); }