From 9026802ed115e8843922a339a25758290073b5ab Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 28 Aug 2024 15:20:11 +0300 Subject: [PATCH] refactor: use-template-literals: reuse isStringLiteral (#1275) --- .../codemods/typescript/use-template-literals/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/codemods/typescript/use-template-literals/src/index.ts b/packages/codemods/typescript/use-template-literals/src/index.ts index 26c232d9e..c006a9f85 100644 --- a/packages/codemods/typescript/use-template-literals/src/index.ts +++ b/packages/codemods/typescript/use-template-literals/src/index.ts @@ -8,11 +8,11 @@ const transformHelper = (node: BinaryExpression, api: API) => { const leftNode = node.left; const rightNode = node.right; const left = - leftNode && leftNode.type === "StringLiteral" + isStringLiteral(leftNode) ? j.literal(leftNode.value) : leftNode; const right = - rightNode && rightNode.type === "StringLiteral" + isStringLiteral(rightNode) ? j.literal(rightNode.value) : rightNode;