mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
update ts def (#15938)
This commit is contained in:
parent
2950219864
commit
9190245b52
@ -62,20 +62,23 @@ export interface BaseButtonProps {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
// Typescript will make optional not optional if use Pick with union.
|
||||
// Should change to `AnchorButtonProps | NativeButtonProps` and `any` to `HTMLAnchorElement | HTMLButtonElement` if it fixed.
|
||||
// ref: https://github.com/ant-design/ant-design/issues/15930
|
||||
export type AnchorButtonProps = {
|
||||
href: string;
|
||||
target?: string;
|
||||
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
||||
onClick?: React.MouseEventHandler<any>;
|
||||
} & BaseButtonProps &
|
||||
Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type'>;
|
||||
Omit<React.AnchorHTMLAttributes<any>, 'type'>;
|
||||
|
||||
export type NativeButtonProps = {
|
||||
htmlType?: ButtonHTMLType;
|
||||
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
||||
onClick?: React.MouseEventHandler<any>;
|
||||
} & BaseButtonProps &
|
||||
Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>;
|
||||
Omit<React.ButtonHTMLAttributes<any>, 'type'>;
|
||||
|
||||
export type ButtonProps = AnchorButtonProps | NativeButtonProps;
|
||||
export type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>;
|
||||
|
||||
interface ButtonState {
|
||||
loading?: boolean | { delay?: number };
|
||||
|
Loading…
Reference in New Issue
Block a user