From 426082dfc1b8749f1631b7ba545e11399b8f966c Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Thu, 8 Aug 2024 19:28:32 +0800 Subject: [PATCH] chore(tree-select): improve code style by restProps (#50314) --- components/tree-select/index.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index c382020c8e..b9e0a38cfb 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -89,7 +89,10 @@ const InternalTreeSelect = < ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = BaseOptionType, >( - { + props: TreeSelectProps, + ref: React.Ref, +) => { + const { prefixCls: customizePrefixCls, size: customizeSize, disabled: customDisabled, @@ -119,10 +122,8 @@ const InternalTreeSelect = < variant: customVariant, dropdownStyle, tagRender, - ...props - }: TreeSelectProps, - ref: React.Ref, -) => { + ...restProps + } = props; const { getPopupContainer: getContextPopupContainer, getPrefixCls, @@ -203,7 +204,7 @@ const InternalTreeSelect = < // ===================== Icons ===================== const { suffixIcon, removeIcon, clearIcon } = useIcons({ - ...props, + ...restProps, multiple: isMultiple, showSuffixIcon, hasFeedback, @@ -223,7 +224,7 @@ const InternalTreeSelect = < } // ==================== Render ===================== - const selectProps = omit(props, [ + const selectProps = omit(restProps, [ 'suffixIcon', 'removeIcon', 'clearIcon',