TanStackT
TanStack12mo ago
6 replies
living-lavender

createServerFn with generic validators and return types

I'm using Start, and there are lots of 'boilerplate'-y code I would need to write for individual types.
I created some builder functions to reduce this boilerplate, but I can't seem to get past this strange TS error in the handler()
Types of property 'records' are incompatible.
     Type 'T[]' is not assignable to type 'TransformerStringify<T, DefaultSerializable>[]'.
         Type 'T' is not assignable to type 'TransformerStringify<T, DefaultSerializable>'. 


Here's a small reproduction of the issue attached.
If anyone knows what the issue could be / how to fix it, I would really appreciate a few pointers :))
Was this page helpful?