feat(@tanstack/query): generate type-safe getQueryData helpers#3827
feat(@tanstack/query): generate type-safe getQueryData helpers#3827inas-sirhan wants to merge 1 commit intohey-api:mainfrom
Conversation
Adds type-safe getQueryData helpers to all 6 tanstack plugins (react, preact, vue, svelte, solid, angular) plus useGetQueryData hook variant for react-query and preact-query. Mirrors the setQueryData implementation from hey-api#3824. Also adds per-plugin "optional fields" test scenarios for preact, vue, svelte, solid, and angular (previously only react-query was covered), backfilling snapshot coverage for setQueryData on those frameworks too. Closes hey-api#3826
|
|
🦋 Changeset detectedLatest commit: 16f02c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@inas-sirhan is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
|
TL;DR — Adds a new Key changes
Summary | 275 files | 1 commit | base:
|
There was a problem hiding this comment.
Reviewed — no issues found.
The implementation cleanly mirrors the existing setQueryData/useSetQueryData pattern with the correct semantic differences: no updater parameter and an explicit .generic(typeResponse) annotation (since TanStack's getQueryData<TData>() requires a type parameter rather than inferring from an argument). Config resolution, guard checks, naming conventions, type definitions, and plugin.ts wiring are all consistent across all 6 frameworks. useGetQueryData is correctly restricted to react-query and preact-query only.
Task list (4/4 completed)
- Checkout PR and read the diff
- Investigate key areas of change in depth
- Self-critique and finalize comments
- Submit review
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3827 +/- ##
==========================================
- Coverage 39.57% 39.40% -0.17%
==========================================
Files 532 534 +2
Lines 19544 19628 +84
Branches 5811 5834 +23
==========================================
Hits 7734 7734
- Misses 9568 9643 +75
- Partials 2242 2251 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@hey-api/codegen-core
@hey-api/json-schema-ref-parser
@hey-api/nuxt
@hey-api/openapi-ts
@hey-api/shared
@hey-api/spec-types
@hey-api/types
@hey-api/vite-plugin
commit: |
|
@inas-sirhan I moved TanStack Query plugin tests into a separate project just like the rest. Can you resolve the conflicts please? |
|
@mrlubos On it! |

Summary
getQueryDataoption to all 6 tanstack plugins (react, preact, vue, svelte, solid, angular) that generates a type-safe helper per query operation, wrappingqueryClient.getQueryData()with the correct query key and response type.useGetQueryDatahook variant for react-query and preact-query that callsuseQueryClient()internally and returns the typed getter.setQueryData/useSetQueryDatafrom feat(@tanstack/query): generate type-safe setQueryData helpers #3824.Closes #3826.
Tests
getQueryDataanduseGetQueryData.setQueryDataon those frameworks.Test plan
pnpm tt -- @hey-api/openapi-ts(plugins.test.ts) — all greenpnpm typecheck— clean