Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queryOptions return wrong type from API function #1946

Closed
1 task
lukasbash opened this issue Oct 10, 2024 · 0 comments
Closed
1 task

queryOptions return wrong type from API function #1946

lukasbash opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working openapi-react-query Relevant to openapi-react-query

Comments

@lukasbash
Copy link

Description

Using openapi-react-query the provided code from the client returns the wrong type from the queryOptions, regardless of the API function behind.
When using useQuery directly everything is inferred correctly.

Reproduction

Simply create a basic API function and inspect the evaluated types of both variants. The one coming from queryOptions is always undefined.

As an example code I used:

  const { data: foo } = QAPI.useQuery("get", "/api/clients");
  const { data: bar } = useQuery(QAPI.queryOptions("get", "/api/clients", {}));

foo evaluates, while bar does not.

See:
image
versus
image

A sidenote: For some reason I am forced to pass a third parameter to the queryOptions call, whereas the docs state it is optional. When omitting the third parameter I am facing this error:
image

Expected result

The type should be identical between in both usage scenarios. Also the function signature should comply to the docs or vice versa.

Checklist

@lukasbash lukasbash added bug Something isn't working openapi-fetch Relevant to the openapi-fetch library labels Oct 10, 2024
@kerwanp kerwanp added openapi-react-query Relevant to openapi-react-query and removed openapi-fetch Relevant to the openapi-fetch library labels Oct 15, 2024
@drwpow drwpow closed this as completed Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-react-query Relevant to openapi-react-query
Projects
None yet
Development

No branches or pull requests

3 participants