Skip to content

queryOptions return wrong type from API function #1946

Closed
@lukasbash

Description

@lukasbash

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-react-queryRelevant to openapi-react-query

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions