Field type for further prop autcomplete
Hello all,
I have a questions. I have tanstack form created with createFormHook. I have InputFormField component provided by the form.
However when I use it like on screenshot it does not show me the props my InputFormField has. So I cannot qutocomplete them. Also if some prop of this field is mandatory - linter will not spot the error. Is there a way I can strictly type it?
Thank you in advance.


5 Replies
afraid-scarlet•5mo ago
your inner field is explicitly typed as
any and therefore ditches any prop constraints that the component haslike-goldOP•5mo ago
But what should I use instead?
afraid-scarlet•5mo ago
it doesn't warn you because
any.<prop> is any again.
you shouldn't need to type fieldInner as anything. Do you get an error if you don't?like-goldOP•5mo ago
Ah. I get it now. I was looking for a type in the library but now I see that I can skip typing at all
afraid-scarlet•5mo ago
Tanstack Form aims to not have you need to specify any generics or type properties. It ideally types them for you
You can read up on the reasoning here