Open 8823-scholar opened 2 years ago
bug report
type Data = { user: { name: string; email: string; }; }; type RecursivePartial<T> = { [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P]; }; <Form<Data, RecursivePartial<Data>> onSubmit={onSubmit}> {({ handleSubmit, form }) => { useEffect(() => { form.initialize({ user: { name: "aaa" } }); }, [form]); return ( <form onSubmit={handleSubmit}> <Field name="user.name" component="input" /> <Field name="user.email" component="input" /> </form> ); }} </Form>
form.initialize values type is Partial<Data>.
form.initialize
Partial<Data>
form.initialize values type should be RecursivePartial<Data>.
RecursivePartial<Data>
https://codesandbox.io/s/laughing-sound-fk5rz4?file=/src/Form.tsx
"final-form": "4.20.7", "react": "18.0.0", "react-dom": "18.0.0", "react-final-form": "6.5.9",
nothing.
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
form.initialize
values type isPartial<Data>
.What is the expected behavior?
form.initialize
values type should beRecursivePartial<Data>
.Sandbox Link
https://codesandbox.io/s/laughing-sound-fk5rz4?file=/src/Form.tsx
What's your environment?
Other information
nothing.