Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

vue-query: UseQueryOptions no longer assignable to queryClient.query() since 5.103.0

Aberta
#12,452 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
Meio dia
Facilidade para iniciantes
67/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
typescript

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgRQK4FMoE8DCAbYdAOxgBo4Ysx04BVAZ3TUywHkwZgIj64BfOADMoEEHADkAARgBDHrIDGAawD0ANwwBaAI4Zs4gFAGAJugV4ZUGgu714EDlx4AuOo2bZ2nWwB4iqEAAjTAA+Ixt5OF0WfEISOABeOCJ0AHcUPVwCYhgACgBKIxUVOBxRMGA8dF5uOABWADoARgAGACYGlvIAFQBlNoB2ADYATjh6YCIFGkbWgGZOgzUIYGMozNichujsXIdvHkKgA

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)
  1. Install @tanstack/[email protected] or newer
  2. Type-check the snippet
  3. 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().

Linguagem predominante
TypeScript
Estrelas
50.5k
Forks
4.2k
Merge médio
6h 27min
PRs com merge (30d)
614

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TanStack/query

Todas as issues de TanStack/query

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.