TanStackT
TanStack10mo ago
9 replies
continuing-aqua

What is the correct form generic for V1

Hello, I asked a similar question yesterday (thanks all for the help), but wanted to focus the conversation because I'm compromising a lot on typing that I had before V1.

In my app, I use forms as props very often.
I used to use this type to do that before:

export type FormType<T> = FormApi<T, Validator<T>> &
  ReactFormApi<T, Validator<T>>;

which gave me good typing on fields and everything.

But from what I understand it has been removed/replaced.

I tried to replace it with:
export type FormType<T> = ReactFormExtendedApi<
  T,
  any,
  any,
  any,
  any,
  any,
  any,
  any,
  any,
  any
>;

but it seems like it can't infer the type of my field's values and if I want to have a generic component that takes a FormType<any>, then it won't take any form unless I manually type them as FormType<any>.

Is there another generic that would be more appropriate, or is there some kind of slot in solution that wouldn't have me rewrite most of my app ?

PS: I'm wondering also about generics for field as prop generics
Was this page helpful?