TanStackT
TanStack3mo ago
5 replies
wet-aqua

Typing of data for useQuery when placeholder data is set?

Something I noticed recently is that when using placeholder data, the return type of useQuery in the react package is undefined. This seems counter intuitive? I would expect that with a static object in placeholderData that the return type of data would be defined. Further, in my very basic testing it is always defined?

TS Playground
Screenshot_2025-10-30_at_09.51.06.png
Screenshot_2025-10-30_at_09.50.53.png
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
Was this page helpful?