type: improve type (#56401)

This commit is contained in:
遇见同学
2025-12-28 20:14:57 +08:00
committed by GitHub
parent 6ed7b0f045
commit ec0bdd2984
6 changed files with 6 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ export interface ScrollNumberProps {
motionClassName?: string;
count?: string | number | null;
children?: React.ReactElement;
component?: React.ComponentType<any>;
component?: React.ComponentType<React.HTMLAttributes<HTMLElement>>;
style?: React.CSSProperties;
title?: string | number | null;
show: boolean;

View File

@@ -105,7 +105,7 @@ const ButtonTypeMap: Partial<Record<ButtonType, ColorVariantPairType>> = {
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'],
};

View File

@@ -242,7 +242,7 @@ const Search = React.forwardRef<InputRef, SearchProps>((props, ref) => {
onChange,
disabled,
},
Object.keys(rootProps) as any[],
Object.keys(rootProps) as Array<keyof typeof rootProps>,
);
return (

View File

@@ -35,7 +35,7 @@ export interface PureContentProps {
export const PureContent: React.FC<React.PropsWithChildren<PureContentProps>> = (props) => {
const { prefixCls, type, icon, children, classNames: pureContentClassNames, styles } = props;
const iconElement = icon || (type && TypeIcon[type]);
const iconNode = cloneElement<any>(iconElement, (currentProps) => {
const iconNode = cloneElement<React.HTMLAttributes<HTMLElement>>(iconElement, (currentProps) => {
const mergedStyle: React.CSSProperties = { ...currentProps?.style, ...styles?.icon };
return {
className: clsx(currentProps.className, pureContentClassNames?.icon),

View File

@@ -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;

View File

@@ -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;