mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
chore: improve Form.create ts definition of Form (#5420)
* improve Form.create ts definition of Form * use function<T>() instead of arrow function
This commit is contained in:
parent
4a9ae162c6
commit
637d9243ea
@ -75,14 +75,11 @@ export type WrappedFormUtils = {
|
||||
};
|
||||
|
||||
export interface FormComponentProps {
|
||||
form?: WrappedFormUtils;
|
||||
form: WrappedFormUtils;
|
||||
}
|
||||
|
||||
export class FormComponent extends React.Component<FormComponentProps, {}> {
|
||||
}
|
||||
|
||||
export interface ComponentDecorator {
|
||||
<T extends (typeof FormComponent)>(component: T): T;
|
||||
export interface ComponentDecorator<TOwnProps> {
|
||||
(component: React.ComponentClass<FormComponentProps & TOwnProps>): React.ComponentClass<TOwnProps>;
|
||||
}
|
||||
|
||||
export default class Form extends React.Component<FormProps, any> {
|
||||
@ -109,7 +106,7 @@ export default class Form extends React.Component<FormProps, any> {
|
||||
|
||||
static Item = FormItem;
|
||||
|
||||
static create = (options?: FormCreateOption): ComponentDecorator => {
|
||||
static create = function<TOwnProps>(options?: FormCreateOption): ComponentDecorator<TOwnProps> {
|
||||
const formWrapper = createDOMForm(assign({
|
||||
fieldNameProp: 'id',
|
||||
}, options, {
|
||||
|
Loading…
Reference in New Issue
Block a user