How to retrieve type of serverFn's returned data?
I've defined a serverFn like so:
In earlier TanStack versions I was able to do:
and this worked fine e.g
FetchedData
was just { message: string }
or whatever;
But now, FetchedData
is a more complex type: { message: string } | FullFetcherData<undefined, { message: string }>;
Is there maybe a type helper I should be using here?4 Replies
like-goldOP•7mo ago
Couldn't find a type helper included for this but put together my own using the available types:
Usage:
Lmk if this is not intended/optimal!
rare-sapphire•7mo ago
cc @Chris Horobin do we want to offer an official helper here?
gradual-turquoise•7mo ago
No helpers yet for start
rare-sapphire•7mo ago
yet 😁 but would be a nice addition