Skip to content

fix(query): resolve UseInfiniteQueryOptions type error with TanStack Query v5.80.0+ #2151

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

Merged
merged 1 commit into from
Jun 8, 2025

Conversation

matsu3m
Copy link
Contributor

@matsu3m matsu3m commented Jun 7, 2025

Status

READY

Description

Fixes #2145
Fix #2153

Starting from TanStack Query v5.80.0, PR #9224 removed the unnecessary TQueryData generic from InfiniteQueryObserverOptions, reducing the number of type parameters from 6 to 5. This change causes type errors in Orval-generated code.

スクリーンショット 2025-06-08 1 49 37

This fix adds version detection to conditionally generate the correct number of type arguments:

  • For v5.80.0 and later: generates 5 arguments (excluding the redundant funcReturnType)
  • For earlier versions: retains 6 arguments for backward compatibility

Steps to Test or Reproduce

  1. Set the @tanstack/react-query (or vue-query, svelte-query) package version to below 5.80.0 (e.g., 5.79.0)
  2. Run Orval – generated code should use 6 type arguments in UseInfiniteQueryOptions
  3. Set the version to 5.80.0 or above (e.g., 5.80.0 or latest)
  4. Run Orval again – generated code should use 5 type arguments (excluding the redundant funcReturnType)

@melloware melloware merged commit 725e6a6 into orval-labs:master Jun 8, 2025
2 checks passed
@ph8nt0m
Copy link

ph8nt0m commented Jun 10, 2025

@melloware What version should be used to solve this problem?

@melloware melloware added this to the 7.10.0 milestone Jun 10, 2025
@melloware
Copy link
Collaborator

@ph8nt0m has not been released yet this was just fixed will be in next release 7.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants