From ed608fd795534176806e33c08d70b387b19fa3b9 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 11 May 2023 09:17:07 +0800 Subject: [PATCH] fix: error TS2339: Property 'find' does not exist on type 'string | SchemaEnum' --- .../src/schema-component/antd/association-field/util.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/association-field/util.ts b/packages/core/client/src/schema-component/antd/association-field/util.ts index bb5f68c27b..7a876ddfc8 100644 --- a/packages/core/client/src/schema-component/antd/association-field/util.ts +++ b/packages/core/client/src/schema-component/antd/association-field/util.ts @@ -30,9 +30,10 @@ const toArr = (v) => { }; export const getLabelFormatValue = (labelUiSchema: ISchema, value: any, isTag = false): any => { - if (Array.isArray(labelUiSchema?.enum) && value) { + const options = labelUiSchema?.enum; + if (Array.isArray(options) && value) { const values = toArr(value).map((val) => { - const opt: any = labelUiSchema.enum.find((option: any) => option.value === val); + const opt: any = options.find((option: any) => option.value === val); if (isTag) { return React.createElement(Tag, { color: opt?.color }, opt?.label); }