type: improve tree component assert (#49784)

This commit is contained in:
thinkasany 2024-07-09 16:26:35 +08:00 committed by GitHub
parent 17ad651752
commit 5f09772967
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View File

@ -264,10 +264,10 @@ const InternalTreeSelect = <
hashId,
);
const renderSwitcherIcon = (nodeProps: AntTreeNodeProps) => (
const renderSwitcherIcon: React.FC<AntTreeNodeProps> = (nodeProps) => (
<SwitcherIconCom
prefixCls={treePrefixCls}
switcherIcon={switcherIcon as any}
switcherIcon={switcherIcon as SwitcherIcon}
treeNodeProps={nodeProps}
showLine={treeLine}
/>
@ -297,8 +297,8 @@ const InternalTreeSelect = <
placement={memoizedPlacement}
removeIcon={removeIcon}
allowClear={mergedAllowClear}
switcherIcon={renderSwitcherIcon as any}
showTreeIcon={treeIcon as any}
switcherIcon={renderSwitcherIcon as RcTreeSelectProps['switcherIcon']}
showTreeIcon={treeIcon as boolean}
notFoundContent={mergedNotFound}
getPopupContainer={getPopupContainer || getContextPopupContainer}
treeMotion={null}

View File

@ -120,7 +120,7 @@ const DirectoryTree: React.ForwardRefRenderFunction<RcTree, DirectoryTreeProps>
// const newState: DirectoryTreeState = {};
// We need wrap this event since some value is not same
const newEvent: any = {
const newEvent = {
...event,
selected: true, // Directory selected always true
};

View File

@ -224,10 +224,10 @@ const Tree = React.forwardRef<RcTree, TreeProps>((props, ref) => {
return mergedDraggable;
}, [draggable]);
const renderSwitcherIcon = (nodeProps: AntTreeNodeProps) => (
const renderSwitcherIcon: React.FC<AntTreeNodeProps> = (nodeProps) => (
<SwitcherIconCom
prefixCls={prefixCls}
switcherIcon={switcherIcon as any}
switcherIcon={switcherIcon as SwitcherIcon}
treeNodeProps={nodeProps}
showLine={showLine}
/>
@ -258,7 +258,7 @@ const Tree = React.forwardRef<RcTree, TreeProps>((props, ref) => {
direction={direction}
checkable={checkable ? <span className={`${prefixCls}-checkbox-inner`} /> : checkable}
selectable={selectable}
switcherIcon={renderSwitcherIcon as any}
switcherIcon={renderSwitcherIcon as RcTreeProps['switcherIcon']}
draggable={draggableConfig}
>
{children}