Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Export MutationResult type

Aperta Adatta ai principianti
#11,930 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

Inizia dagli export dei tipi Vue Query di useMutation e dalla dichiarazione di MutationResult; l’issue non indica percorsi dei file del repository, quindi individuali dai punti di ingresso pubblici dell’adapter Vue. Riproduci l’errore segnalato con il sandbox collegato e pnpm exec vue-tsc --build --noEmit --force. Il lavoro è completato quando il tipo è nominabile pubblicamente e il comando termina senza errori.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

I am trying to upgrade @tanstack/vue-query to version 5.104.0, but I am encountering a typescript error in my mutators -- the ones that use the useMutation export.

For example,

// useExampleMutation.ts

import { useMutation } from '@tanstack/vue-query'

export const useExampleMutation = () => {
  return useMutation({
    mutationFn: async () => 'ok',
  })
}

Typescript fails with the following error when reading this module:

TS2883: The inferred type of 'useExampleMutation' cannot be named without a reference to 'MutationResult' from '@tanstack/vue-query/build/modern/useMutation'. This is likely not portable. A type annotation is necessary.

Project conditions under which this error was encountered:

.nvmrc

24

package.json

{
  "dependencies": {
    "@tanstack/vue-query": "5.104.0",
    "vue": "3.5.43"
  },
  "devDependencies": {
    "@tsconfig/node24": "24.0.5",
    "@vitejs/plugin-vue": "^6.0.9",
    "typescript": "^6.0.3",
    "vite": "8.3.1",
    "vue-tsc": "^3.3.11"
  },
  "packageManager": "[email protected]+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319"
}

tsconfig.json

{
  "compilerOptions": {
    "composite": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "strict": true,
    "target": "esnext",
    "skipLibCheck": true
  },
  "include": ["src"]
}

tsconfig.node.json

{
  "extends": "@tsconfig/node24/tsconfig.json",
  "compilerOptions": {
    "composite": true,
    "skipLibCheck": true,
    "module": "ESNext",
    "moduleResolution": "bundler",
    "allowSyntheticDefaultImports": true
  },
  "include": ["vite.config.ts"]
}

I have added a link to a sandbox with the example module and relevant configs, as requested.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/hvgzvv

Steps to reproduce

Assuming the project is a minimal reproduction as provided in the sandbox link:

  1. run nvm install 24 to make sure Node 24 is present
  2. run nvm use to make sure Node 24 is the active runtime
  3. run corepack install to make sure that pnpm is available
  4. run pnpm install
  5. run pnpm exec vue-tsc --build --noEmit --force to produce the typescript error
Expected behavior

Running pnpm exec vue-tsc --build --noEmit --force returns with 0 errors reported.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform
  • OS: macOS
  • Browser: not applicable (vue-tsc)
  • Version: not applicable (vue-tsc)
Tanstack Query adapter

vue-query

TanStack Query version

v5.104.0

TypeScript version

v6.0.3

Additional context

Originally (sloppily) reported with AI "assistance" in https://github.com/TanStack/query/issues/11769. Apologies for missing the mark on your AI Contribution Policy. I am a real developer, and this is a real problem I really encountered.

Lingua principale
TypeScript
Stelle
50.4k
Fork
4.2k
Merge medio
6h 55m
PR unite (30g)
390

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/query

Tutte le issue di TanStack/query

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.