[vue-query] 5.103.0: UseQueryOptions is no longer assignable to ensureQueryData, fetchQuery and prefetchQuery
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 74/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- TypeScript
- 星號
- 50.4k
- 分支
- 4.2k
- 平均合併
- 17 小時 50 分鐘
- 30 天內合併 PR
- 297
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TanStack/query 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
TanStack/query#11358 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
TanStack/query#11106 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 62/100
TanStack/query#11663 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 58/100
TanStack/query#11642 · 1 則留言 ·
維護者通常 1 天內回覆
相似的 Issue
-
needs:triage
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
ai-discovered
難度 2/5 1-3 小時 新手友好度 83/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
jessepollak/home#1627 ·
維護者通常 1 天內回覆
-
agent-canvas bug llm priority:low ready-for-dev
難度 2/5 1-3 小時 新手友好度 82/100
OpenHands/OpenHands#17806 · 3 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
radius-project/ai-extensions#923 ·
維護者通常 1 天內回覆