You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
useQuery silently accepts queryOptions in the options parameter without type error #2642
When calling $api.useQuery, it's possible to accidentally pass React Query options (retry, refetchInterval, refetchOnMount, etc.) as the 3rd argument (options) instead of the 4th argument (queryOptions). TypeScript does not flag this, and at runtime the options are silently ignored.
This applies to endpoints that don't have options parameters defined in the schema.
importcreateClientfrom"openapi-react-query";importcreateFetchClientfrom"openapi-fetch";constfetchClient=createFetchClient<paths>({baseUrl: "https://api.example.com"});const$api=createClient(fetchClient);// No type error — but `refetchOnMount` and `retry` are silently swallowed// by the fetch client and never reach React Queryconstquery=$api.useQuery("get","/me",{retry: false,refetchOnMount: false,});// Correct usage (options in 4th arg):constquery=$api.useQuery("get","/me",undefined,{retry: false,refetchOnMount: false,});
Expected result
Passing queryOptions as the third param should raise a type error
Activity