Skip to content

Bug: Cannot use createForm() instance with <Form/> normally #910

Open

Description

@OnkelTem

After creating a form with createForm():

type FormValues = {
  name: string;
};

const initialValues: FormValues = {
  name: 'Foo',
};

const form = createForm({
    initialValues: initialValues,
    onSubmit: submitForm,
}),

I cannot use it in a normal way in: <Form form={form} render={...}>.

return (
    <Form
        form={form}
        render={...}
    />
)

Instead TypeScript starts complaining about wrong `onSubmit`:

TS2741: Property 'onSubmit' is missing in type '{ form: FormApi<FormValues, Partial>; render: ({ handleSubmit, form, submitting, pristine, values }: FormRenderProps<FormValues, Partial>) => Element; }' but required in type 'FormProps<FormValues, Partial>'.


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions