i currently using nextjs 14, i having a problem on onSuccess section keep showing no overload matches this call, need help and guide on this.
the program language i using.
npm: '10.4.0',
node: '21.6.1',
acorn: '8.11.3',
ada: '2.7.4',
ares: '1.20.1',
base64: '0.5.1',
brotli: '1.1.0',
cjs_module_lexer: '1.2.2',
cldr: '44.0',
icu: '74.1',
llhttp: '9.1.3',
modules: '120',
napi: '9',
nghttp2: '1.58.0',
nghttp3: '0.7.0',
ngtcp2: '0.8.1',
openssl: '3.0.12+quic',
simdjson: '3.6.3',
simdutf: '4.0.8',
tz: '2023c',
undici: '5.28.2',
unicode: '15.1',
uv: '1.47.0',
uvwasi: '0.0.19',
v8: '11.8.172.17-node.19',
zlib: '1.3.0.1-motley-40e35a7'
import { useRouter, useSearchParams } from "next/navigation"
import { trpc } from "../_trpc/client"
const Page = async () => {
const router = useRouter()
const searchParams = useSearchParams()
const origin = searchParams.get('origin')
const {data, isLoading} = trpc.authCallback.useQuery(undefined, {
onSuccess: ({success}) => { <==== error here
if(success) {
router.push(origin ? `/${origin}` : '/dashboard')
}
}
})
}
export default Page
the error code
No overload matches this call.
Overload 1 of 2, '(input: void, opts: DefinedUseTRPCQueryOptions<{ success: boolean; }, { success: boolean; }, TRPCClientErrorLike<{ errorShape: DefaultErrorShape; transformer: false; }>, { ...; }>): DefinedUseTRPCQueryResult<...>', gave the following error.
Object literal may only specify known properties, and 'onSuccess' does not exist in type 'DefinedUseTRPCQueryOptions<{ success: boolean; }, { success: boolean; }, TRPCClientErrorLike<{ errorShape: DefaultErrorShape; transformer: false; }>, { success: boolean; }>'.
Overload 2 of 2, '(input: void, opts?: UseTRPCQueryOptions<{ success: boolean; }, { success: boolean; }, TRPCClientErrorLike<{ input: void; output: { success: boolean; }; transformer: false; errorShape: DefaultErrorShape; }>, { ...; }> | undefined): UseTRPCQueryResult<...>', gave the following error.
Object literal may only specify known properties, and 'onSuccess' does not exist in type 'UseTRPCQueryOptions<{ success: boolean; }, { success: boolean; }, TRPCClientErrorLike<{ input: void; output: { success: boolean; }; transformer: false; errorShape: DefaultErrorShape; }>, { ...; }>'.ts(2769)
i expect to solve only “onSuccess: ({success})” error section.