test({vue,svelte}-query): add type tests for inferring the result type from a generic 'queryFn' - #11464
Conversation
… from a generic 'queryFn'
…t type from a generic 'queryFn'
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe pull request adds type-level tests for generic query functions in Svelte Query and Vue Query. The tests verify inferred ChangesGeneric query inference
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds Vue and Svelte type coverage confirming generic query functions infer string data and nullable query errors as expected. It does not change runtime behavior or published APIs, and no merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit b0b6581
☁️ Nx Cloud last updated this comment at |
size-limit report 📦
|
🚀 Changeset Version Preview2 package(s) bumped directly, 23 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
🎯 Changes
vue-queryandsvelte-querywere the only adapters without a type test covering result type inference through a genericqueryFn.react-query,preact-query,solid-query, andangular-query-experimentalall assert this in theiruseQuery/injectQuerytype tests, so this brings the two remaining adapters in line.Each new test declares a generic function whose type parameter defaults to
string, passes it as thequeryFn, and asserts that the default propagates todata:packages/vue-query/src/__tests__/useQuery.test-d.ts— newgeneric queryFndescribe, placed beforegeneric queryKey inference (#8199)so thequeryFncase precedes thequeryKeyone.packages/svelte-query/tests/createQuery/createQuery.test-d.ts— newgeneric queryFndescribe as a sibling of the existinginitialDatablock.Both assert
dataisstring | undefinedanderrorisError | null, matching the assertions the other adapters already make.Type tests only — no runtime or published code is touched.
✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit