From bb43704b644949cf5592de27a902c9b115440008 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 30 Jan 2022 18:50:28 +0800 Subject: [PATCH] chore: check string first in toDisplayString --- packages/shared/src/toDisplayString.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/toDisplayString.ts b/packages/shared/src/toDisplayString.ts index 62a042be..efe3b7cc 100644 --- a/packages/shared/src/toDisplayString.ts +++ b/packages/shared/src/toDisplayString.ts @@ -5,7 +5,8 @@ import { isFunction, isPlainObject, isSet, - objectToString + objectToString, + isString } from './index' /** @@ -13,7 +14,9 @@ import { * @private */ export const toDisplayString = (val: unknown): string => { - return val == null + return isString(val) + ? val + : val == null ? '' : isArray(val) || (isObject(val) &&