From e38939698cc6646112590016891a908a1267f7f4 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 28 Aug 2023 02:38:04 +0800 Subject: [PATCH] refactor: simplify logic --- src/core/utils.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/utils.ts b/src/core/utils.ts index 56ad798..939db8e 100644 --- a/src/core/utils.ts +++ b/src/core/utils.ts @@ -53,11 +53,8 @@ export function printVueAcceptableTypeLiteralFromSymbols( const typeString = typeChecker.typeToString( typeChecker.getBaseTypeOfLiteralType(type), ); - let questionMark = ""; - if (decl.questionToken) { - questionMark = "?"; - } - push( + let questionMark =decl.questionToken?'?': ""; + push( `${decl.name.getText()}${questionMark}: ${toVueAcceptableType( typeString, )};`,