Error with useForm : Type instantiation is excessively deep and possibly infinite
Hy everyone, i have a error with useForm when i want to make a form and definite in a context the error throw : Type instantiation is excessively deep and possibly infinite.
Do you say how to resolve the error and where she come ?
Code :
Form Context
8 Replies
fascinating-indigoOP•4w ago
*My context: *
extended-salmon•4w ago
1. We don't recommend shimming our types, as they are not considered breaking changes. See the Philosophy section and TypeScript section for more info.
2. Which part errors with the excessively deep type?
fascinating-indigoOP•4w ago
ok but i not found natif generic types and i think this part
my error appears on :
but my error disappears if I update this type to any in ControllingType
extended-salmon•4w ago
What's the structure of the whole form? How "global" is this form state?
fascinating-indigoOP•4w ago
I tried to make a global useForm for create easy a form with useForm and centralized all form, so in my ControllingContext i create a instance of GlobalForm
extended-salmon•4w ago
The main issue with this is
* You take away the typing written by us. The shim you provided is wrong, for example, and will break for any
<form.Field />, <form.AppField />, <form.Subscribe />, withForm components and withFieldGroup components.
* You break your code when upgrading TanStack Form.
This section is very important to us in the previously linked docs:
extended-salmon•4w ago
I don't know how your page will be structured, so it's difficult to help out with a recommended way.
The context provider you're making seems to always be made with
useAppForm and defaultValues: ControllingFilters.
Therefore, this might work:
fascinating-indigoOP•4w ago
okey i have make like this :
*ControllingForm 😗
This resolve my error, ty for ur help