Skip to content

Commit

Permalink
add a generic type for FormCreateOption (ant-design#7119)
Browse files Browse the repository at this point in the history
  • Loading branch information
djyde authored and afc163 committed Aug 9, 2017
1 parent 87bfe2d commit df93444
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import warning from '../_util/warning';
import FormItem from './FormItem';
import { FIELD_META_PROP } from './constants';

export interface FormCreateOption {
onFieldsChange?: (props: any, fields: Array<any>) => void;
onValuesChange?: (props: any, values: any) => void;
mapPropsToFields?: (props: any) => void;
export interface FormCreateOption<T> {
onFieldsChange?: (props: T, fields: Array<any>) => void;
onValuesChange?: (props: T, values: any) => void;
mapPropsToFields?: (props: T) => void;
withRef?: boolean;
}

Expand Down Expand Up @@ -139,7 +139,7 @@ export default class Form extends React.Component<FormProps, any> {

static Item = FormItem;

static create = function<TOwnProps>(options: FormCreateOption = {}): ComponentDecorator<TOwnProps> {
static create = function<TOwnProps>(options: FormCreateOption<TOwnProps> = {}): ComponentDecorator<TOwnProps> {
const formWrapper = createDOMForm({
fieldNameProp: 'id',
...options,
Expand Down

0 comments on commit df93444

Please sign in to comment.