T
TanStack2y ago
robust-apricot

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
ambitious-aqua
ambitious-aqua2y ago
I'm gonna need a playground to see what you mean. This question isn't super clear as-is
robust-apricot
robust-apricotOP2y 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
ambitious-aqua
ambitious-aqua2y 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?