orval-labs / orval

orval is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml or json formats. 🍺
https://orval.dev
MIT License
3.21k stars 337 forks source link

ReactQuery: pageParams not inheriting initialPageParam type (always unknown) #1597

Open vitorcamachoo opened 3 months ago

vitorcamachoo commented 3 months ago

What are the steps to reproduce this issue?

  1. Generate react-query with infinite options to enable
  2. On react-query v5, initialPageParam is a required property so we pass it
  3. On the queryFn, the pageParams is not inheriting the type based on what we defined on initialPageParam. It is always considered unknown

What were you expecting to happen?

pageParams should inherit the type defined on initialPageParam

What versions are you using?

System:
    OS: macOS 14.4
    CPU: (11) arm64 Apple M3 Pro
    Memory: 3.34 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  npmPackages:
    @tanstack/react-query: 5.52.1 => 5.52.1 
    axios: 1.7.2 => 1.7.2 
    msw: 1.1.0 => 1.1.0 
    react: 18.2.0 => 18.2.0
    orval: 6.21.0 => 7.0.1

Note: I tried on the latest Orval version, but nothing changed regarding this issue.