vue-query: UseQueryOptions no longer assignable to queryClient.query() since 5.103.0
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 半天
- 新手友好度
- 67/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
Start with the QueryClient overloads for query() and the deprecated prefetchQuery / fetchQuery in the Vue Query adapter, then compare their MaybeRefDeep<...> query function types with UseQueryOptions and the SkipTokenForUseQuery change from #11439. Reproduce the TS2769 error using the issue’s snippet with TypeScript 6.0.3 and Vue Query 5.103.0 or newer. Done when the annotated UseQueryOptions<number> is accepted by these methods and the reported regression is covered by a type check.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
Since 5.103.0, a value typed as UseQueryOptions is no longer accepted by queryClient.query(). It fails with TS2769. The deprecated prefetchQuery / fetchQuery fail the same way.
#11439 added type SkipTokenForUseQuery = symbol to queryFn in UseQueryOptions. The MaybeRefDeep<...> overloads on QueryClient still expect typeof skipToken, so a plain symbol no longer fits. Options inferred through queryOptions() are fine. Only values annotated or cast as UseQueryOptions break, which is what code generators emit.
Your minimal, reproducible example
Steps to reproduce
import { QueryClient, type UseQueryOptions } from '@tanstack/vue-query'
declare const options: UseQueryOptions<number>
const queryClient = new QueryClient()
// Compiles on 5.102.0, TS2769 since 5.103.0
void queryClient.query(options)
- Install
@tanstack/[email protected]or newer - Type-check the snippet
- See TS2769
Expected behavior
A UseQueryOptions value is accepted by queryClient.query(), as in 5.102.0.
How often does this bug happen?
Every time
Platform
Type-check only (tsc / vue-tsc), macOS
Tanstack Query adapter
vue-query
TanStack Query version
v5.103.0 (still present in v5.105.0)
TypeScript version
v6.0.3
Additional context
Found through Orval's generated vue-query prefetch*Query helpers, which cast their options to UseQueryOptions before calling queryClient.query().
- 主要語言
- TypeScript
- 星號
- 50.5k
- 分支
- 4.2k
- 平均合併
- 6 小時 27 分鐘
- 30 天內合併 PR
- 614
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TanStack/query 的其他 Issue
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)可能重新可做 @LeonxLJX 於 56 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
TanStack/query#11358 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
[query-core] [performances] `setQueryData` dispatches a `success` event (and triggers broadcast/persist) even when the new data is structurally identical to the cached data可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 4/5 3-5 天 新手友好度 52/100
維護者通常 1 天內回覆
-
refetchQueries with throwOnError leaves paused fetch rejection unhandled on client.clear()可能已有人在做 @lazerg 於 2 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 67/100
維護者通常 1 天內回覆
-
useBaseQuery fetches the old query key when an <Activity> tree is revealed可能已有人在做 @lazerg 於 9 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
維護者通常 1 天內回覆
-
[query-broadcast-client-experimental] broadcastQueryClient: an `added` event overwrites a receiving query that has no data (e.g. in error) with the sender's empty state可能已有人在做 @lazerg 於 10 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 25/100
維護者通常 1 天內回覆
相似的 Issue
-
bug triage
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
hemi-earn
難度 2/5 1-3 小時 新手友好度 82/100
vetro-protocol/vetro-monorepo#1043 ·
維護者通常 1 天內回覆
-
stage 2: bare names resolve against PATH differently from the shell (empty and relative entries)未關閉
難度 2/5 1-3 小時 新手友好度 82/100
STRML/omp-classifier#206 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
atlassian-labs/mermaid-diagrams-viewer#188 ·
維護者通常 1 天內回覆
-
dashboard enhancement
難度 2/5 1-3 小時 新手友好度 76/100
Olanetsoft/agent-lookout#225 ·
維護者通常 1 天內回覆