T
TanStack9mo ago
quickest-silver

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...
No description
2 Replies
probable-pink
probable-pink9mo ago
do you have strictNullChecks/strict enabled?
quickest-silver
quickest-silverOP9mo ago
we do not. thanks, this is the reason!

Did you find this page helpful?