From 515ee751cb66be12d0886cb86cb1418b59e5ba89 Mon Sep 17 00:00:00 2001 From: Suwings Date: Mon, 24 Jan 2022 17:03:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E7=A9=BA=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entity/instance/instance.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/entity/instance/instance.ts b/src/entity/instance/instance.ts index 0f08bcf..6e43c00 100644 --- a/src/entity/instance/instance.ts +++ b/src/entity/instance/instance.ts @@ -162,7 +162,13 @@ export default class Instance extends EventEmitter { else self[key] = Number(v); } - else if (typeFn) { + if (typeFn === String) { + if (v === null) { + self[key] = null; + } else { + self[key] = String(v); + } + } else if (typeFn) { self[key] = typeFn(v); } else { self[key] = v;