Describe the bug#
Trying to run the optimistic updates typescript examples in the example folder on my local machine gives the following error: Argument of type 'UseQueryOptions<Todos, AxiosError<any>, TData, QueryKey> | undefined' is not assignable to parameter of type 'Omit<UseQueryOptions<Todos, AxiosError<any>, TData, "todos">, "queryKey" | "queryFn"> | undefined'.
Your minimal, reproducible example#
The optimistic updates typescript example in the examples folder
Steps to reproduce#
- Clone repository
- Run
yarn in the examples\optimistic-updates-typescript folder
- Run yarn dev, open the browser
Expected behavior#
The app runs like it does in the example in the docs
How often does this bug happen?#
Every time
Screenshots or Videos#

Platform#
Windows 11 Home 21H2
Edge 98.0.1108.56 (Official build) (64-bit)
Yarn v1.22.15
NPM 6.14.15
Node 14.18.2
react-query version#
Commit eb4e863cf44d30ef8b936068fce09f9632def68a (latest at the moment)
TypeScript version#
No response
Additional context#
No response
The example was built with react-query 3.5.1, which is why it works in codesandbox.
for the latest version, the
optionsneed toomitqueryKeyandqueryFn:I wouldn't make such an abstraction anymore, as it's pretty wide. I'll adapt the example for v4. The whole
TodoCounterthing is unnecessary in v4 when tracked queries are the new default.