From 842eb46d46e4a55883c27ecb53f32631b4c0689b Mon Sep 17 00:00:00 2001 From: wangzhiyusss Date: Mon, 18 Aug 2025 19:38:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BD=AC=E6=8D=A2=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangzhiyusss --- build-tools/intToNumber.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/build-tools/intToNumber.js b/build-tools/intToNumber.js index 92a43c7f00..00efb38d76 100644 --- a/build-tools/intToNumber.js +++ b/build-tools/intToNumber.js @@ -307,7 +307,6 @@ function applJSDocTransformations(typeExpr, newTypeExpr, tagDataList, isChange) if (finalContent.includes('number') && typeExpr.kind === ts.SyntaxKind.JSDocNullableType && !finalContent.includes('?number') && isChange) { if (typeExpr.type.type && typeExpr.type.type.kind === ts.SyntaxKind.UnionType) { const data = { - isDelete: false, pos: typeExpr.pos, end: typeExpr.end, convertedText: '?' + `(${finalContent})` @@ -315,7 +314,6 @@ function applJSDocTransformations(typeExpr, newTypeExpr, tagDataList, isChange) tagDataList.push(data); } else { const data = { - isDelete: false, pos: typeExpr.pos, end: typeExpr.end, convertedText: '?' + finalContent @@ -324,7 +322,6 @@ function applJSDocTransformations(typeExpr, newTypeExpr, tagDataList, isChange) } } else if (finalContent.includes('number')) { const data = { - isDelete: true, pos: typeExpr.pos, end: typeExpr.end, convertedText: finalContent @@ -344,10 +341,10 @@ function changeContent(tagDataList) { for (const data of tagDataList) { const before = jsDocContent.substring(0, data.pos); const after = jsDocContent.substring(data.end); - if (data.isDelete) { - jsDocContent = before + `${data.convertedText}` + after; - } else { + if (jsDocContent.substring(data.pos, data.pos + 1) === ' ') { jsDocContent = before + ` ${data.convertedText}` + after; + } else { + jsDocContent = before + `${data.convertedText}` + after; } } } -- Gitee