7nohe / openapi-react-query-codegen

Node.js library that generates React Query (also called TanStack Query) hooks based on an OpenAPI specification file.
253 stars 25 forks source link

fix: Use optional query keys also without parameters #116

Closed mmurto closed 4 months ago

mmurto commented 4 months ago

The query key functions for queries that don't take in additional request parameters don't allow for using additional query key input, but query hooks always take in a query key parameter. This leads to the query key parameter in hooks without additional input being unused variable, leading to TypeScript erroring. Fix this by always taking query key parameter in query key functions, and always using it in query hooks.

Fixes #112.

seriouslag commented 4 months ago

Thank you for the PR, this looks great!