Skip to content

TypeScript type for setQueryData updater function #925

Answered by boschni
ryands17 asked this question in General
Discussion options

You must be logged in to vote

Hi @ryands17! When specifying setQueryData<Todos> you are basically saying the result should be of type Todos. Because setQueryData sets the query status to success, and success means the data is there, this would be correct. You could specify the result as setQueryData<Todos | undefined> to also allow undefined.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ryands17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants