mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
Improved Form component typings (#10564)
* Improved Form component typings With this fix you can use HTMLFormElement attributes on Form component without getting TypeScript errors. For example this code does not longer produce error for the additional `autoComplete` prop: ``` const myForm = ( <Form autoComplete="off"> ... </Form> ) ``` * Fix onBlur / onChange typings with Input component This improvement fix a typing issue incompatibility with `react-final-form` The incompatibility involve [this line](https://github.com/final-form/react-final-form/blob/v3.4.2/src/index.d.ts#L20) where the handler argument is a more specific SyntheticEvent
This commit is contained in:
parent
b7d508e166
commit
963120f702
@ -18,7 +18,7 @@ export interface FormCreateOption<T> {
|
||||
|
||||
export type FormLayout = 'horizontal' | 'inline' | 'vertical';
|
||||
|
||||
export interface FormProps {
|
||||
export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
||||
layout?: FormLayout;
|
||||
form?: WrappedFormUtils;
|
||||
onSubmit?: React.FormEventHandler<any>;
|
||||
|
@ -38,8 +38,8 @@ export interface InputProps extends AbstractInputProps {
|
||||
onKeyUp?: React.FormEventHandler<HTMLInputElement>;
|
||||
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
||||
onClick?: React.FormEventHandler<HTMLInputElement>;
|
||||
onFocus?: React.FormEventHandler<HTMLInputElement>;
|
||||
onBlur?: React.FormEventHandler<HTMLInputElement>;
|
||||
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
||||
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
||||
autoComplete?: string;
|
||||
prefix?: React.ReactNode;
|
||||
suffix?: React.ReactNode;
|
||||
|
Loading…
Reference in New Issue
Block a user