mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
type: improve type (#56401)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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'],
|
||||
};
|
||||
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user