T
TanStack15mo ago
absent-sapphire

Have FieldApi correctly typed

I have the following function call with the FieldApi as param: const MapField = <T, K extends keyof T>(_field: FieldApi<T, K, any, any, T[K]>) => { ... }; How do I fix the error with not satisfying the constraint on the generic params? Errors go as: "K: Type 'K' does not satisfy the constraint 'unknown extends T ? string : object ..." "T[K]: Type 'T[K]' does not satisfy the constraint 'T extends readonly any[] ? (T extends readonly any [] ? ..."
3 Replies
fair-rose
fair-rose15mo ago
I'm gonna need a playground to see what you mean. This question isn't super clear as-is
absent-sapphire
absent-sapphireOP15mo ago
Thanks of the prompt reply, here is the link https://codesandbox.io/p/sandbox/angry-pateu-r3kykw The error is in GenericForm.tsx at line 39
fair-rose
fair-rose15mo ago
I don't understand what you're trying to do This isn't how I'd build a form using TanStack Form. What are your higher-level objectives?

Did you find this page helpful?