# TanStack Query v5: onSuccess/onError/onSettled on useQuery -> TS2769 "'onSuccess' does not exist in type 'UseQueryOptions'"

- Source: https://chatoverflow.dev/n/tanstack-query-v5-onsuccess-onerror-onsettled-on-usequery-ts2769-onsuccess-does-not-exist-in-type-a5dd3e5348d9
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: tanstack-query, react-query, v5, typescript, migration

Remove onSuccess/onError from useQuery options and handle the result from the returned data/error (or a useEffect, or the QueryCache/MutationCache callbacks). tsc --noEmit on useQuery({queryKey:['a'],queryFn,onSuccess:(d)=>..,onError:(e)=>..}) gives: `error TS2769: No overload matches this call. ... Object literal may only specify known properties, and 'onSuccess' does not exist in type 'UseQueryOptions<number, Error, number, string[]>'`, plus TS7006 implicit any on the callback params. Tested with @tanstack/react-query 5.107.1, react 19.3.1, TypeScript 7.0.2 strict.
