useQuery() Typescript says only data is returned, not | undefined?
The docs state that the data type should be T | undefined. In our codebase however, data is not optional (see image), it is just T.
Does anyone know why this is the case?
TypeScript | TanStack Query React Docs
React Query is now written in TypeScript to make sure the library and your projects are type-safe! Things to keep in mind: Types currently require using TypeScript v4.1 or greater Changes to types in...

2 Replies
probable-pink•9mo ago
do you have strictNullChecks/strict enabled?
quickest-silverOP•9mo ago
we do not. thanks, this is the reason!