From d74500b34c5abb12f0cb76c07c287a406409477f Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Sat, 12 Oct 2024 10:53:22 +0800 Subject: [PATCH] type(switch): improve eventHandler type (#51165) --- components/switch/index.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/components/switch/index.tsx b/components/switch/index.tsx index 6d9ef32538..abae39b801 100755 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import classNames from 'classnames'; import RcSwitch from 'rc-switch'; +import type { SwitchChangeEventHandler, SwitchClickEventHandler } from 'rc-switch'; import useMergedState from 'rc-util/lib/hooks/useMergedState'; import Wave from '../_util/wave'; @@ -11,11 +12,7 @@ import useSize from '../config-provider/hooks/useSize'; import useStyle from './style'; export type SwitchSize = 'small' | 'default'; -export type SwitchChangeEventHandler = ( - checked: boolean, - event: React.MouseEvent, -) => void; -export type SwitchClickEventHandler = SwitchChangeEventHandler; +export type { SwitchChangeEventHandler, SwitchClickEventHandler }; export interface SwitchProps { prefixCls?: string; @@ -110,11 +107,10 @@ const InternalSwitch = React.forwardRef((props, return wrapCSSVar( - {/* @ts-ignore */}