Skip to content

Commit ec0bdd2

Browse files
authored
type: improve type (ant-design#56401)
1 parent 6ed7b0f commit ec0bdd2

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

components/badge/ScrollNumber.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface ScrollNumberProps {
1111
motionClassName?: string;
1212
count?: string | number | null;
1313
children?: React.ReactElement;
14-
component?: React.ComponentType<any>;
14+
component?: React.ComponentType<React.HTMLAttributes<HTMLElement>>;
1515
style?: React.CSSProperties;
1616
title?: string | number | null;
1717
show: boolean;

components/button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const ButtonTypeMap: Partial<Record<ButtonType, ColorVariantPairType>> = {
105105
primary: ['primary', 'solid'],
106106
dashed: ['default', 'dashed'],
107107
// `link` is not a real color but we should compatible with it
108-
link: ['link' as any, 'link'],
108+
link: ['link' as ButtonColorType, 'link'],
109109
text: ['default', 'text'],
110110
};
111111

components/input/Search.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ const Search = React.forwardRef<InputRef, SearchProps>((props, ref) => {
242242
onChange,
243243
disabled,
244244
},
245-
Object.keys(rootProps) as any[],
245+
Object.keys(rootProps) as Array<keyof typeof rootProps>,
246246
);
247247

248248
return (

components/message/PurePanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface PureContentProps {
3535
export const PureContent: React.FC<React.PropsWithChildren<PureContentProps>> = (props) => {
3636
const { prefixCls, type, icon, children, classNames: pureContentClassNames, styles } = props;
3737
const iconElement = icon || (type && TypeIcon[type]);
38-
const iconNode = cloneElement<any>(iconElement, (currentProps) => {
38+
const iconNode = cloneElement<React.HTMLAttributes<HTMLElement>>(iconElement, (currentProps) => {
3939
const mergedStyle: React.CSSProperties = { ...currentProps?.style, ...styles?.icon };
4040
return {
4141
className: clsx(currentProps.className, pureContentClassNames?.icon),

components/message/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ methods.forEach((type: keyof MessageMethods) => {
328328
// ==============================================================================
329329
const noop = () => {};
330330

331-
let _actWrapper: (wrapper: any) => void = noop;
331+
let _actWrapper: (wrapper: (fn: () => void) => void) => void = noop;
332332
if (process.env.NODE_ENV === 'test') {
333333
_actWrapper = (wrapper) => {
334334
act = wrapper;

components/notification/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ methods.forEach((type: keyof NoticeMethods) => {
247247
// ==============================================================================
248248
const noop = () => {};
249249

250-
let _actWrapper: (wrapper: any) => void = noop;
250+
let _actWrapper: (wrapper: (fn: () => void) => void) => void = noop;
251251
if (process.env.NODE_ENV === 'test') {
252252
_actWrapper = (wrapper) => {
253253
act = wrapper;

0 commit comments

Comments
 (0)