From f0059cebc24bd113ac135b188872a972031c8bdc Mon Sep 17 00:00:00 2001 From: kang Date: Tue, 27 Jun 2023 23:37:24 +0800 Subject: [PATCH] type: pass-through cascader option generic type (#43231) --- components/cascader/index.tsx | 47 +++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 08ab5a23bf..a6a35bcaaf 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -96,30 +96,39 @@ const defaultSearchRender: ShowSearchType['render'] = (inputValue, path, prefixC return optionList; }; -type SingleCascaderProps = Omit & { +type SingleCascaderProps = Omit< + RcSingleCascaderProps, + 'checkable' | 'options' +> & { multiple?: false; }; -type MultipleCascaderProps = Omit & { +type MultipleCascaderProps = Omit< + RcMultipleCascaderProps, + 'checkable' | 'options' +> & { multiple: true; }; -type UnionCascaderProps = SingleCascaderProps | MultipleCascaderProps; - -export type CascaderProps = UnionCascaderProps & { - multiple?: boolean; - size?: SizeType; - disabled?: boolean; - bordered?: boolean; - placement?: SelectCommonPlacement; - suffixIcon?: React.ReactNode; - options?: DataNodeType[]; - status?: InputStatus; - - rootClassName?: string; - popupClassName?: string; - /** @deprecated Please use `popupClassName` instead */ - dropdownClassName?: string; -}; +type UnionCascaderProps = + | SingleCascaderProps + | MultipleCascaderProps; + +export type CascaderProps = + UnionCascaderProps & { + multiple?: boolean; + size?: SizeType; + disabled?: boolean; + bordered?: boolean; + placement?: SelectCommonPlacement; + suffixIcon?: React.ReactNode; + options?: DataNodeType[]; + status?: InputStatus; + + rootClassName?: string; + popupClassName?: string; + /** @deprecated Please use `popupClassName` instead */ + dropdownClassName?: string; + }; export interface CascaderRef { focus: () => void;