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
I am trying to follow this approach https://tkdodo.eu/blog/the-query-options-api, exporting only the query options and then we can prevent earlier abstractions, especially when extending the options of a query.
My approach was using the *QueryOptions generated interface and using their options to extend whatever I want so the result can be used with useQuery (for example).
The problem is that the generated query options do not pass correctly the select type to the result as we can see in the following images.
Query options builder:
Result 1:
Result 2:
Result 3:
By the way, what would be the best option to type the query options builder function? Sometimes I use:
1.
We could also integrate a new configuration in the Orval to only generate the query options because, in my scenario, I am only interested in the query options and not in the useQuery* interfaces.
What are the steps to reproduce this issue?
I am trying to follow this approach https://tkdodo.eu/blog/the-query-options-api, exporting only the query options and then we can prevent earlier abstractions, especially when extending the options of a query.
My approach was using the *QueryOptions generated interface and using their options to extend whatever I want so the result can be used with
useQuery
(for example).The problem is that the generated query options do not pass correctly the select type to the result as we can see in the following images.
Query options builder:
Result 1:
Result 2:
Result 3:
By the way, what would be the best option to type the query options builder function? Sometimes I use:
1.
None of them works 100%.
One suggestion would be to start using what react query provides,
queryOptions
andinfiniteQueryOptions
. This would make the generated code much more prepared to be extended and they are useful when talking about types as we can see in the above blog post.Example: https://github.com/kubb-labs/kubb/blob/main/examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts#L27
We could also integrate a new configuration in the Orval to only generate the query options because, in my scenario, I am only interested in the query options and not in the useQuery* interfaces.
What versions are you using?
The text was updated successfully, but these errors were encountered: