From 46eaefec334ec512f9afb0fc09a7dc0f7e95cc7a Mon Sep 17 00:00:00 2001 From: tre0521 Date: Wed, 23 Jul 2025 10:20:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AE=89=E5=85=A8=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 97cdb1593..9bc8acaef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2776,7 +2776,7 @@ function generateFromPartial(ctx: Context, fullName: string, messageDesc: Descri const fallback = noDefaultValue ? "undefined" : "[]"; chunks.push(code` - ${messageProperty} = ${objectProperty}?.map((e) => ${readSnippet("e")}) || ${fallback}; + ${messageProperty} = Array.isArray(${objectProperty})? ${objectProperty}.map((e) => ${readSnippet("e")}): ${fallback}; `); } } else if (isWithinOneOfThatShouldBeUnion(options, field)) {