Export MutationResult type
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- api
Rechercherichtung
Beginne mit den Vue Query-Typ-Exports von useMutation und der Deklaration von MutationResult; das Issue nennt keine Repository-Dateipfade, daher solltest du diese über die öffentlichen Einstiegspunkte des Vue-Adapters finden. Reproduziere den gemeldeten Fehler mit der verlinkten Sandbox und pnpm exec vue-tsc --build --noEmit --force. Das Ziel ist erreicht, wenn der Typ öffentlich benennbar ist und der Befehl ohne Fehler abgeschlossen wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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:
- run
nvm install 24to make sure Node 24 is present - run
nvm useto make sure Node 24 is the active runtime - run
corepack installto make sure thatpnpmis available - run
pnpm install - run
pnpm exec vue-tsc --build --noEmit --forceto 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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 50.4k
- Forks
- 4.2k
- Ø Merge
- 6 Std. 55 Min.
- Gemergte PRs (30 T.)
- 390
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
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
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)Evtl. wieder frei @LeonxLJX hat das vor 35 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
TanStack/query#11358 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
solid-query: switching the queryClient accessor strands the new client's cache (subscription stays on the old observer)Evtl. vergeben @MaNaN1803 hat das vor 78 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
TanStack/query#11106 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
restoreQueries and persisterGc throw on malformed persisted entriesEvtl. vergeben @VGontier-cmd hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/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
-
setQueryData: NoInfer loses discriminated-union members when spreading a narrowed updater valueEvtl. vergeben @iosayin hat das vor 5 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
[Docs] README: FAQ setup command, IDA in the intro, Node badgeEvtl. vergeben @akram1089 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
morluto/rea#1353 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Feature]: [P3] engine-rs: the package source hash should ignore line endings and untracked filesOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
maniator/verticopolis#880 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
siyuan-note/siyuan#20353 ·
Maintainer antworten meist innerhalb von 1 Tag
-
afk-ok area:data-quality importer size:S
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
enorm-labs/event-junkie#3027 ·
Maintainer antworten meist innerhalb von 1 Tag