[vue-query] 5.103.0: UseQueryOptions is no longer assignable to ensureQueryData, fetchQuery and prefetchQuery
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 74/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- developer-experience, frontend
Rechercherichtung
Start with the TypeScript definitions for UseQueryOptions and QueryClient's ensureQueryData, fetchQuery, and prefetchQuery entry points, comparing the 5.102.8 and 5.103.0 behavior. Add a regression type test that passes UseQueryOptions with a widened symbol to all three methods, while confirming useQuery still compiles.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
Since 5.103.0, a value typed as UseQueryOptions can still be passed to useQuery, but no longer to the query client's ensureQueryData, fetchQuery or prefetchQuery:
Type 'symbol' is not assignable to type 'MaybeRefDeep<unique symbol | QueryFunction<string, readonly unknown[], never> | undefined>'.
#11439 widened queryFn in UseQueryOptions with SkipTokenForUseQuery = symbol. The query client methods still take query-core's options, whose queryFn accepts only typeof skipToken, a unique symbol. Plain symbol is not assignable to it, so the whole options object is rejected.
This hits generated clients: Orval's vue-query output types every get…QueryOptions() getter as UseQueryOptions, so queryClient.ensureQueryData(getXQueryOptions()), the usual pattern in a router guard, stops compiling.
Your minimal, reproducible example
Steps to reproduce
import { QueryClient, useQuery, type UseQueryOptions } from '@tanstack/vue-query'
declare const options: UseQueryOptions<string>
const client = new QueryClient()
useQuery(options) // compiles
client.ensureQueryData(options) // error since 5.103.0
client.fetchQuery(options) // error since 5.103.0
client.prefetchQuery(options) // error since 5.103.0
Expected behavior
Options that useQuery accepts are also accepted by ensureQueryData, fetchQuery and prefetchQuery, as in 5.102.8.
How often does this bug happen?
Every time
Platform
- OS: macOS 26 and Ubuntu (GitHub Actions)
- Browser: none, this is a compile-time error from tsc and vue-tsc
- Version: n/a
Tanstack Query adapter
vue-query
TanStack Query version
v5.103.2
TypeScript version
v6.0.3
Additional context
#11439's new type tests cover useQuery and queryOptions, but none passes UseQueryOptions to a query client method. Passing a literal skipToken to ensureQueryData still compiles. Only the widened symbol fails.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 50.3k
- Forks
- 4.2k
- Ø Merge
- 23 Std. 7 Min.
- Gemergte PRs (30 T.)
- 231
Entwicklungsumgebung
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus TanStack/query
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
TanStack/query#11358 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
TanStack/query#11106 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 58/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 40/100
TanStack/query#11586 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
ADD openalgoOffentemplate
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
vercel/ai#21528 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug Needs: Triage :mag:
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
microsoft/fluentui-contrib#671 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
sveltejs/acorn-typescript#150 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100