Description
If fetch is used to generate infinite queries with vue-query typescript complains that:
Argument of type 'MaybeRef<number>' is not assignable to parameter of type 'number'.
Type 'Ref<number, number>' is not assignable to type 'number'.
Fetch-style functions accept plain values, but axios-style accept MaybeRef<T> so they unref() MaybeRef values internally. This difference causes the the error.
Output client
vue-query
Configuration (orval.config)
import { defineConfig } from "orval";
const GENERATED_PATH = "./src/generated/aggregator";
export default defineConfig({
admin: {
output: {
client: "vue-query",
mode: "tags",
target: `${GENERATED_PATH}/services`,
schemas: `${GENERATED_PATH}/models`,
clean: true,
override: {
query: {
useQuery: true,
useInfinite: true,
useInfiniteQueryParam: 'limit',
},
mutator: {
path: "./fetch.ts",
name: "$fetch",
},
}
},
input: {
target: "./openapi/openapi.yaml",
},
},
});
Environment
System:
OS: macOS 26.3.1
CPU: (12) arm64 Apple M4 Pro
Memory: 1.18 GB / 24.00 GB
Shell: 5.9 - /bin/zsh
npmPackages:
@tanstack/vue-query: ^5.96.1 => 5.96.1
orval: ^8.6.2 => 8.6.2
vue: ^3.5.31 => 3.5.31
Expected behavior
If fetch or custom client is used params should be wrapped in unref()
Actual behavior
Params are not unrefed and typescript shows:
OpenAPI document (minimal, if applicable)
openapi: 3.0.0
info:
title: Multi query params
version: 1.0.0
paths:
/users/{userId}/orders:
get:
summary: Get user orders
description: Retrieves a list of orders for a specific user with optional filtering
parameters:
# Path parameter
- in: path
name: userId
required: true
schema:
type: integer
description: The unique identifier of the user
example: 12345
# Query parameters
- in: query
name: status
required: false
schema:
type: string
enum: [pending, completed, cancelled]
description: Filter orders by status
example: completed
- in: query
name: fromDate
required: false
schema:
type: string
format: date
description: Filter orders from this date (YYYY-MM-DD)
example: '2024-01-01'
- in: query
name: limit
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
description: Maximum number of orders to return
responses:
'200':
description: A list of orders
content:
application/json:
schema:
type: array
items:
type: string
Additional context
No response
Description
If fetch is used to generate infinite queries with
vue-querytypescript complains that:Fetch-style functions accept plain values, but axios-style accept
MaybeRef<T>so theyunref()MaybeRef values internally. This difference causes the the error.Output client
vue-query
Configuration (orval.config)
Environment
System:
OS: macOS 26.3.1
CPU: (12) arm64 Apple M4 Pro
Memory: 1.18 GB / 24.00 GB
Shell: 5.9 - /bin/zsh
npmPackages:
@tanstack/vue-query: ^5.96.1 => 5.96.1
orval: ^8.6.2 => 8.6.2
vue: ^3.5.31 => 3.5.31
Expected behavior
If
fetchorcustomclient is used params should be wrapped inunref()Actual behavior
Params are not unrefed and typescript shows:
OpenAPI document (minimal, if applicable)
Additional context
No response