Hey!
I have a swagger that returns a file, which is generated as a Blob type in react-query-swagger.
I wanted to create URL.createObjectURL out of it in the select option.
These are the type definitions that are generated:
export function useAQuery<TSelectData = Types.FileResponse, TError = unknown>(dto: AQueryParameters, options?: Omit<UseQueryOptions<Types.FileResponse, TError, TSelectData>, 'queryKey'>): UseQueryResult<TSelectData, TError>;
/**
* Get A
* @return Success
*/
export function useAQuery<TSelectData = Types.FileResponse, TError = unknown>(a: string, b: string, options?: Omit<UseQueryOptions<TSelectData, TError, TSelectData>, 'queryKey'>): UseQueryResult<TSelectData, TError>;
As u can see the UseQueryOptions with DTO uses Types.FileResponse as hardcoded value for the TQueryFnData in UseQueryOptions (which is correct I believe), while the type definition with primitive parameters use TSelectData.
That breaks a case when we want to override select function passed as an option.
DTO works:
TS2322: Type (blob: FileResponse) => string is not assignable to type (data: FileResponse) => FileResponse
Type string is not assignable to type FileResponse
Hey! I have a swagger that returns a file, which is generated as a
Blob
type inreact-query-swagger
. I wanted to createURL.createObjectURL
out of it in theselect
option.These are the type definitions that are generated:
As u can see the UseQueryOptions with DTO uses
Types.FileResponse
as hardcoded value for theTQueryFnData
inUseQueryOptions
(which is correct I believe), while the type definition with primitive parameters useTSelectData
.That breaks a case when we want to override
select
function passed as anoption
. DTO works:Expanded version throws an error:
Let me know if that is intended behavior and I'm missing something or if that's a bug. I can contribute if that's a bug.
Cheers.