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
When creating a custom mutator functions with a generic data param (e.g. const customInstance = <T>) the dynamic type is not defined on any param of the generated code.
for instance, the function that fetches data has the following param:
exportconstgetTodoById=(todoId: string,params?: GetTodoByIdParams,// include the data typeoptions?: SecondParameter<typeofcustomInstance<TodoResponse>>,signal?: AbortSignal)=>{returncustomInstance<TodoResponse>({url: `/todos/${encodeURIComponent(String(todoId))}`,method: 'GET',
params,
signal
},options);}exportconstgetGetTodoByIdQueryOptions=<TData=Awaited<ReturnType<typeofgetTodoById>>,TError=ErrorType<GetTodoById500>>(todoId: string,params?: GetTodoByIdParams,options?: {query?:UseQueryOptions<Awaited<ReturnType<typeofgetTodoById>>,TError,TData>,// include the returned data typerequest?: SecondParameter<typeofcustomInstance<<Awaited<ReturnType<typeofgetTodoById>>>>>})=>{ ... }exportfunctionuseGetTodoById<TData=Awaited<ReturnType<typeofgetTodoById>>,TError=ErrorType<GetTodoById401>>>(todoId: string,params?: GetTodoByIdIdParams,options?: {query?:UseQueryOptions<Awaited<ReturnType<typeofgetTodoById>>,TError,TData>,// include the returned data typerequest?: SecondParameter<typeofcustomInstance<<Awaited<ReturnType<typeofgetTodoById>>>>>}
the same goes when output httpClient is set to axios
it create the config without the data type:
axios?: AxiosRequestConfig
but ideally it should also include the data type:
axios?: AxiosRequestConfig<TodoResponse>
this could potentially break existing code, so maybe there should be a configuration options for it as well?
Thanks
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
docs for reference.
When creating a custom mutator functions with a generic data param (e.g.
const customInstance = <T>
) the dynamic type is not defined on any param of the generated code.for instance, the function that fetches data has the following param:
but ideally, it should look like this:
this has a cascading effect, which the query and query option functions also need to have the data type.
for a more detailed example, I have this custom mutator:
the ideal result should look something like this:
the same goes when output
httpClient
is set toaxios
it create the config without the data type:
but ideally it should also include the data type:
this could potentially break existing code, so maybe there should be a configuration options for it as well?
Thanks
The text was updated successfully, but these errors were encountered: