From 7c27ca25ff619c0b2bdaf38ebe0747c015046811 Mon Sep 17 00:00:00 2001 From: jzh <1587315093@qq.com> Date: Wed, 19 Jul 2023 16:30:16 +0800 Subject: [PATCH] chore: type enhance --- src/components/steps/steps.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/steps/steps.tsx b/src/components/steps/steps.tsx index 224c3de33b..944c3ef5c1 100644 --- a/src/components/steps/steps.tsx +++ b/src/components/steps/steps.tsx @@ -36,24 +36,24 @@ export const Steps: FC = p => { props,
{React.Children.map(props.children, (child, index) => { - if (!React.isValidElement(child)) { + if (!React.isValidElement(child)) { return child } - const props = child.props as StepProps - let status = props.status || 'wait' + const childProps = child.props + let status = childProps.status || 'wait' if (index < current) { - status = props.status || 'finish' + status = childProps.status || 'finish' } else if (index === current) { - status = props.status || 'process' + status = childProps.status || 'process' } - const icon = props.icon ?? defaultIcon + const icon = childProps.icon ?? defaultIcon return React.cloneElement(child, { status, icon, - } as StepProps) + }) })}
)