From 926062ac7b602c4003fe50b76bf3085f5a77bce6 Mon Sep 17 00:00:00 2001 From: hmydgz Date: Fri, 26 Jul 2024 11:46:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D=20Cont?= =?UTF-8?q?roller=20path=20=E4=B8=BA=E7=A9=BA=E6=97=B6=20version=20?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/ast.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/ast.ts b/src/utils/ast.ts index 43ff9e4..d7edc7b 100644 --- a/src/utils/ast.ts +++ b/src/utils/ast.ts @@ -145,9 +145,7 @@ export namespace NestDecorator { version: [], } - if (_node.length === 0) { - obj.path = [''] - } else { + if (_node.length) { switch (_node[0].kind) { case ts.SyntaxKind.StringLiteral: case ts.SyntaxKind.ArrayLiteralExpression: { @@ -171,6 +169,8 @@ export namespace NestDecorator { } } + if (!obj.path?.length) obj.path = [''] + return obj } }