I am making use of useQuery from react-query and I need to dynamically pass the query parameter
But i am struggling to get the types to work correctly
query function
interface ProfileResponse {
photo: string
about: string
languages: number[] | null
userid: number
}
export const get_profile_q= (uid: number) =>
api.get(`/api/profile/${uid}`) as Promise<UseQueryResult<ProfileResponse>>
used inside component
const { refetch: getProfile } = useQuery([PK.get_profile, {uid: 1}], get_profile_q)
// ^^^ throwing typescript error
error
Type '(uid: number) => Promise<UseQueryResult<ProfileResponse, unknown>>'
has no properties in common with type 'Omit<UseQueryOptions<unknown, unknown, unknown,
(string | { uid: number; })[]>, "queryKey">'.