Conversation
|
👷 Deploy request for openapi-ts pending review.Visit the deploys page to approve it
|
| // Helper type to infer TPageParam type | ||
| type InferPageParamType<T> = T extends { initialPageParam: infer P } ? P : unknown; | ||
|
|
||
| export type InfiniteQueryOptionsFunction< |
There was a problem hiding this comment.
Did you mean to include this type? I think it'd be good to also include the infiniteQueryOptions() helper for completeness as well as mutationOptions() but probably outside the scope of this PR.
There was a problem hiding this comment.
@jamesmoss
Yes, that’s correct. In my previous PR I added it together with the infiniteQueryOptions changes to strengthen the typing for infinite queries, so it seems to have been carried over. That was my mistake. I’ll remove this part and update the source. Thanks for the feedback.
- Remove InfiniteQueryOptionsFunction type (not used) - Fix mutation onSuccess test to match React Query callback signature
…callback signatures React Query's onSuccess callback signature varies between versions. Instead of asserting exact call arguments, now verify only the first two arguments (data and variables) using mock.calls to be version-agnostic.
3b8a0c9 to
f2ca453
Compare
|
Nice! Just what we needed. Would be great to get this in 👏 |
|
👀 |
|
Echoing above comments here but would be awesome to get this in! What is still blocking this PR? |
|
@duncanbeevers @martyndavies @garyposter @jamesmoss |
|
@minchodang Sorry, I don't have anything to do with code reviews for OpenAPI TypeScript. However, I would like to echo that seeing this merged would be great 👍 |
|
Any updates on this? Would be great to have this functionality |
Changes
$api.mutationOptionshelper toopenapi-react-query, mirroring the existing query helpers so consumers can generate fully typed React Query mutation configs without rewriting fetchers.docs/openapi-react-query/mutation-options.mdwith a worked example, API breakdown, and guidance on when to prefer it over$api.useMutation.How to Review
packages/openapi-react-query/src/index.tsto confirmmutationOptionsshares the same contract as$api.useMutation, especially around the inferred types and key generation.packages/openapi-react-query/test/to verify they cover both the happy path and type expectations for the new helper.pnpm docs:dev→/openapi-react-query/mutation-options) to ensure the example builds, links resolve, and the narrative aligns with the query-side documentation.pnpm check(or the repo’s CI equivalent) before merging.Checklist
docs/updated (if necessary)pnpm run update:examplesrun (only applicable for openapi-typescript)