From ec0bdd2984def7f6de2a3ac1d89eec610d794d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=81=87=E8=A7=81=E5=90=8C=E5=AD=A6?= <1875694521@qq.com> Date: Sun, 28 Dec 2025 20:14:57 +0800 Subject: [PATCH] type: improve type (#56401) --- components/badge/ScrollNumber.tsx | 2 +- components/button/Button.tsx | 2 +- components/input/Search.tsx | 2 +- components/message/PurePanel.tsx | 2 +- components/message/index.tsx | 2 +- components/notification/index.tsx | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/badge/ScrollNumber.tsx b/components/badge/ScrollNumber.tsx index b45c7cb13b..140146905e 100644 --- a/components/badge/ScrollNumber.tsx +++ b/components/badge/ScrollNumber.tsx @@ -11,7 +11,7 @@ export interface ScrollNumberProps { motionClassName?: string; count?: string | number | null; children?: React.ReactElement; - component?: React.ComponentType; + component?: React.ComponentType>; style?: React.CSSProperties; title?: string | number | null; show: boolean; diff --git a/components/button/Button.tsx b/components/button/Button.tsx index ce1b3fa31d..c0e620401f 100644 --- a/components/button/Button.tsx +++ b/components/button/Button.tsx @@ -105,7 +105,7 @@ const ButtonTypeMap: Partial> = { primary: ['primary', 'solid'], dashed: ['default', 'dashed'], // `link` is not a real color but we should compatible with it - link: ['link' as any, 'link'], + link: ['link' as ButtonColorType, 'link'], text: ['default', 'text'], }; diff --git a/components/input/Search.tsx b/components/input/Search.tsx index 3f6514374e..40840fca80 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -242,7 +242,7 @@ const Search = React.forwardRef((props, ref) => { onChange, disabled, }, - Object.keys(rootProps) as any[], + Object.keys(rootProps) as Array, ); return ( diff --git a/components/message/PurePanel.tsx b/components/message/PurePanel.tsx index 41929ca2b6..bfa4a10c7f 100644 --- a/components/message/PurePanel.tsx +++ b/components/message/PurePanel.tsx @@ -35,7 +35,7 @@ export interface PureContentProps { export const PureContent: React.FC> = (props) => { const { prefixCls, type, icon, children, classNames: pureContentClassNames, styles } = props; const iconElement = icon || (type && TypeIcon[type]); - const iconNode = cloneElement(iconElement, (currentProps) => { + const iconNode = cloneElement>(iconElement, (currentProps) => { const mergedStyle: React.CSSProperties = { ...currentProps?.style, ...styles?.icon }; return { className: clsx(currentProps.className, pureContentClassNames?.icon), diff --git a/components/message/index.tsx b/components/message/index.tsx index b24b3b1124..5990afa712 100755 --- a/components/message/index.tsx +++ b/components/message/index.tsx @@ -328,7 +328,7 @@ methods.forEach((type: keyof MessageMethods) => { // ============================================================================== const noop = () => {}; -let _actWrapper: (wrapper: any) => void = noop; +let _actWrapper: (wrapper: (fn: () => void) => void) => void = noop; if (process.env.NODE_ENV === 'test') { _actWrapper = (wrapper) => { act = wrapper; diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 93c5252cb2..7b027d2f63 100755 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -247,7 +247,7 @@ methods.forEach((type: keyof NoticeMethods) => { // ============================================================================== const noop = () => {}; -let _actWrapper: (wrapper: any) => void = noop; +let _actWrapper: (wrapper: (fn: () => void) => void) => void = noop; if (process.env.NODE_ENV === 'test') { _actWrapper = (wrapper) => { act = wrapper;