Skip to content

Commit

Permalink
Update some types
Browse files Browse the repository at this point in the history
Should fix rekit#104
  • Loading branch information
SpadarShut authored Nov 17, 2021
1 parent afb2f89 commit e0c5d82
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export = FormBuilder;
export as namespace FormBuilder;

declare const FormBuilder: React.FC<FormBuilderInterface> & {
defineWidget: (key: string, component: React.ReactComponentElement, metaConvertor?: (field: FieldType) => FieldType) => void
defineWidget: (key: string, component: React.ReactComponentElement, metaConvertor?: (field: FieldType) => FieldType) => void;
useForceUpdate: () => (() => void);
}

export declare type FormItemLayoutType = {
Expand Down Expand Up @@ -167,11 +168,23 @@ export declare type Meta = {
gutter?: number;
}

export interface FormBuilderInterface {
meta: Meta | FieldType | FieldType[];
interface FormBuilderBase {
form: FormInstance<any>;
viewMode?: boolean;
initialValues?: any;
disabled?: boolean;
}

export type MetaProp = Meta | FieldType | FieldType[];

interface FormBuilderMeta extends FormBuilderBase {
meta: MetaProp;
getMeta?: never;
}

interface FormBuilderGetMeta extends FormBuilderBase {
meta?: never;
getMeta: (form: FormInstance<any>, props: FormBuilderGetMeta) => MetaProp;
}

export type FormBuilderInterface = FormBuilderMeta | FormBuilderGetMeta;

0 comments on commit e0c5d82

Please sign in to comment.