diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index f0ab97c62c..f4644dc38e 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -19,10 +19,10 @@ export interface BreadcrumbItemProps { /** @deprecated Please use `menu` instead */ overlay?: DropdownProps['overlay']; } -interface BreadcrumbItemInterface extends React.FC { +type CompoundedComponent = React.FC & { __ANT_BREADCRUMB_ITEM: boolean; -} -const BreadcrumbItem: BreadcrumbItemInterface = (props) => { +}; +const BreadcrumbItem: CompoundedComponent = (props) => { const { prefixCls: customizePrefixCls, separator = '/', diff --git a/components/breadcrumb/BreadcrumbSeparator.tsx b/components/breadcrumb/BreadcrumbSeparator.tsx index ef8fd08bd7..1b21a51fa3 100644 --- a/components/breadcrumb/BreadcrumbSeparator.tsx +++ b/components/breadcrumb/BreadcrumbSeparator.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; import { ConfigContext } from '../config-provider'; -interface BreadcrumbSeparatorInterface extends React.FC<{ children?: React.ReactNode }> { +type CompoundedComponent = React.FC<{ children?: React.ReactNode }> & { /** @internal */ __ANT_BREADCRUMB_SEPARATOR: boolean; -} +}; -const BreadcrumbSeparator: BreadcrumbSeparatorInterface = ({ children }) => { +const BreadcrumbSeparator: CompoundedComponent = ({ children }) => { const { getPrefixCls } = React.useContext(ConfigContext); const prefixCls = getPrefixCls('breadcrumb'); diff --git a/components/collapse/Collapse.tsx b/components/collapse/Collapse.tsx index a4f5afc144..06cd7cc84e 100644 --- a/components/collapse/Collapse.tsx +++ b/components/collapse/Collapse.tsx @@ -50,11 +50,11 @@ interface PanelProps { collapsible?: CollapsibleType; } -interface CollapseInterface extends React.FC { +type CompoundedComponent = React.FC & { Panel: typeof CollapsePanel; -} +}; -const Collapse: CollapseInterface = (props) => { +const Collapse: CompoundedComponent = (props) => { const { getPrefixCls, direction } = React.useContext(ConfigContext); const { prefixCls: customizePrefixCls, diff --git a/components/dropdown/dropdown-button.tsx b/components/dropdown/dropdown-button.tsx index be10e541c6..de76357f1e 100644 --- a/components/dropdown/dropdown-button.tsx +++ b/components/dropdown/dropdown-button.tsx @@ -28,12 +28,12 @@ export interface DropdownButtonProps extends ButtonGroupProps, DropdownProps { buttonsRender?: (buttons: React.ReactNode[]) => React.ReactNode[]; } -interface DropdownButtonInterface extends React.FC { +type CompoundedComponent = React.FC & { /** @internal */ __ANT_BUTTON: boolean; -} +}; -const DropdownButton: DropdownButtonInterface = (props) => { +const DropdownButton: CompoundedComponent = (props) => { const { getPopupContainer: getContextPopupContainer, getPrefixCls, diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 2607cef590..d424dddc94 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -82,12 +82,12 @@ export interface DropdownProps { onVisibleChange?: (open: boolean) => void; } -interface DropdownInterface extends React.FC { +type CompoundedComponent = React.FC & { Button: typeof DropdownButton; _InternalPanelDoNotUseOrYouWillBeFired: typeof WrapPurePanel; -} +}; -const Dropdown: DropdownInterface = (props) => { +const Dropdown: CompoundedComponent = (props) => { const { getPopupContainer: getContextPopupContainer, getPrefixCls, diff --git a/components/empty/index.tsx b/components/empty/index.tsx index b57844a5e9..407d9d6cee 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -25,12 +25,12 @@ export interface EmptyProps { children?: React.ReactNode; } -interface EmptyType extends React.FC { +type CompoundedComponent = React.FC & { PRESENTED_IMAGE_DEFAULT: React.ReactNode; PRESENTED_IMAGE_SIMPLE: React.ReactNode; -} +}; -const Empty: EmptyType = ({ +const Empty: CompoundedComponent = ({ className, prefixCls: customizePrefixCls, image = defaultEmptyImg, diff --git a/components/form/FormItem/index.tsx b/components/form/FormItem/index.tsx index 1940beff60..06a7b47b77 100644 --- a/components/form/FormItem/index.tsx +++ b/components/form/FormItem/index.tsx @@ -393,11 +393,11 @@ function InternalFormItem(props: FormItemProps): React.Rea type InternalFormItemType = typeof InternalFormItem; -interface FormItemInterface extends InternalFormItemType { +type CompoundedComponent = InternalFormItemType & { useStatus: typeof useFormItemStatus; -} +}; -const FormItem = InternalFormItem as FormItemInterface; +const FormItem = InternalFormItem as CompoundedComponent; FormItem.useStatus = useFormItemStatus; export default FormItem; diff --git a/components/form/index.tsx b/components/form/index.tsx index f9db083efc..0db1262972 100644 --- a/components/form/index.tsx +++ b/components/form/index.tsx @@ -13,7 +13,7 @@ import useFormInstance from './hooks/useFormInstance'; type InternalFormType = typeof InternalForm; -interface FormInterface extends InternalFormType { +type CompoundedComponent = InternalFormType & { useForm: typeof useForm; useFormInstance: typeof useFormInstance; useWatch: typeof useWatch; @@ -24,9 +24,9 @@ interface FormInterface extends InternalFormType { /** @deprecated Only for warning usage. Do not use. */ create: () => void; -} +}; -const Form = InternalForm as FormInterface; +const Form = InternalForm as CompoundedComponent; Form.Item = Item; Form.List = List; diff --git a/components/pagination/Select.tsx b/components/pagination/Select.tsx index a78c82f054..b0cec749a2 100644 --- a/components/pagination/Select.tsx +++ b/components/pagination/Select.tsx @@ -2,12 +2,12 @@ import * as React from 'react'; import type { SelectProps } from '../select'; import Select from '../select'; -interface MiniOrMiddleSelectInterface extends React.FC { +type CompoundedComponent = React.FC & { Option: typeof Select.Option; -} +}; -const MiniSelect: MiniOrMiddleSelectInterface = (props) => ; +const MiniSelect: CompoundedComponent = (props) => ; MiniSelect.Option = Select.Option; MiddleSelect.Option = Select.Option; diff --git a/components/skeleton/Skeleton.tsx b/components/skeleton/Skeleton.tsx index cd3acf4486..058253b214 100644 --- a/components/skeleton/Skeleton.tsx +++ b/components/skeleton/Skeleton.tsx @@ -16,7 +16,7 @@ import Title from './Title'; import useStyle from './style'; /* This only for skeleton internal. */ -interface SkeletonAvatarProps extends Omit {} +type SkeletonAvatarProps = Omit; export interface SkeletonProps { active?: boolean; diff --git a/components/statistic/Countdown.tsx b/components/statistic/Countdown.tsx index 579707b536..42175e481e 100644 --- a/components/statistic/Countdown.tsx +++ b/components/statistic/Countdown.tsx @@ -8,7 +8,7 @@ import { formatCountdown } from './utils'; const REFRESH_INTERVAL = 1000 / 30; -interface CountdownProps extends StatisticProps { +export interface CountdownProps extends StatisticProps { value?: countdownValueType; format?: string; onFinish?: () => void; diff --git a/components/statistic/Statistic.tsx b/components/statistic/Statistic.tsx index 16427d5184..796c50d9f2 100644 --- a/components/statistic/Statistic.tsx +++ b/components/statistic/Statistic.tsx @@ -10,9 +10,9 @@ import type { FormatConfig, valueType } from './utils'; import useStyle from './style'; -interface StatisticComponent { +type CompoundedComponent = { Countdown: typeof Countdown; -} +}; export interface StatisticProps extends FormatConfig { prefixCls?: string; @@ -81,6 +81,6 @@ const Statistic: React.FC = (props) => { const WrapperStatistic = withConfigConsumer({ prefixCls: 'statistic', -})(Statistic); +})(Statistic); export default WrapperStatistic;