TanStackT
TanStack2y ago
4 replies
dead-brown

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 [] ? ..."
Was this page helpful?