From a2bbbd99ad03054a530376657d10a3cc0e4d97f1 Mon Sep 17 00:00:00 2001 From: proteriax <8125011+proteriax@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:51:22 -0400 Subject: [PATCH] Skip empty decorator lists --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6c29a8d..7510b2c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,7 +62,7 @@ export default ({ types: t }: typeof babel): babel.PluginObj => ({ for (const child of path.node.body.body) { switch (child.type) { case "ClassProperty": - if (!child.decorators) continue + if (!child.decorators) break modifiers.push( t.callExpression(state.__decorate(), [ t.arrayExpression(child.decorators.map(d => d.expression)), @@ -112,6 +112,8 @@ export default ({ types: t }: typeof babel): babel.PluginObj => ({ key = child.key } + if (!list.length) break + modifiers.push( t.callExpression(state.__decorate(), [ t.arrayExpression(list),