diff --git a/components/_util/hooks/useClosable.tsx b/components/_util/hooks/useClosable.tsx
index d6fc240168..4b1bd0b8a2 100644
--- a/components/_util/hooks/useClosable.tsx
+++ b/components/_util/hooks/useClosable.tsx
@@ -1,12 +1,8 @@
-import CloseOutlined from '@ant-design/icons/CloseOutlined';
import type { ReactNode } from 'react';
import React from 'react';
+import CloseOutlined from '@ant-design/icons/CloseOutlined';
-function useInnerClosable(
- closable?: boolean,
- closeIcon?: boolean | ReactNode,
- defaultClosable?: boolean,
-): boolean {
+function useInnerClosable(closable?: boolean, closeIcon?: ReactNode, defaultClosable?: boolean) {
if (typeof closable === 'boolean') {
return closable;
}
@@ -18,15 +14,15 @@ function useInnerClosable(
export type UseClosableParams = {
closable?: boolean;
- closeIcon?: boolean | ReactNode;
+ closeIcon?: ReactNode;
defaultClosable?: boolean;
defaultCloseIcon?: ReactNode;
customCloseIconRender?: (closeIcon: ReactNode) => ReactNode;
};
-export default function useClosable(
+function useClosable(
closable?: boolean,
- closeIcon?: boolean | ReactNode,
+ closeIcon?: ReactNode,
customCloseIconRender?: (closeIcon: ReactNode) => ReactNode,
defaultCloseIcon: ReactNode = ,
defaultClosable = false,
@@ -41,3 +37,5 @@ export default function useClosable(
: closeIcon;
return [true, customCloseIconRender ? customCloseIconRender(mergedCloseIcon) : mergedCloseIcon];
}
+
+export default useClosable;
diff --git a/components/alert/Alert.tsx b/components/alert/Alert.tsx
index 00a7a2e4a2..ede1855a7d 100644
--- a/components/alert/Alert.tsx
+++ b/components/alert/Alert.tsx
@@ -43,7 +43,7 @@ export interface AlertProps {
banner?: boolean;
icon?: React.ReactNode;
/** Custom closeIcon */
- closeIcon?: boolean | React.ReactNode;
+ closeIcon?: React.ReactNode;
action?: React.ReactNode;
onMouseEnter?: React.MouseEventHandler;
onMouseLeave?: React.MouseEventHandler;
diff --git a/components/drawer/DrawerPanel.tsx b/components/drawer/DrawerPanel.tsx
index 01fca83cb6..57f5fd2475 100644
--- a/components/drawer/DrawerPanel.tsx
+++ b/components/drawer/DrawerPanel.tsx
@@ -31,7 +31,7 @@ export interface DrawerPanelProps {
* ``
*/
closable?: boolean;
- closeIcon?: boolean | React.ReactNode;
+ closeIcon?: React.ReactNode;
onClose?: RCDrawerProps['onClose'];
children?: React.ReactNode;
diff --git a/components/form/__tests__/index.test.tsx b/components/form/__tests__/index.test.tsx
index 1163695dd2..da48269de2 100644
--- a/components/form/__tests__/index.test.tsx
+++ b/components/form/__tests__/index.test.tsx
@@ -179,7 +179,7 @@ describe('Form', () => {
// https://github.com/ant-design/ant-design/issues/41620
it('should not throw error when `help=false` and `noStyle=true`', async () => {
- const App = (props: { help?: boolean | React.ReactNode }) => {
+ const App: React.FC<{ help?: React.ReactNode }> = (props) => {
const { help = false } = props || {};
return (