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:
feng zhi hao 2017-03-24 11:43:38 +08:00 committed by Benjy Cui
parent 4a9ae162c6
commit 637d9243ea

View File

@ -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, {