Skip to content

test(vue-query/mutationOptions): add type tests for getter overloads#10466

Merged
sukvvon merged 2 commits intomainfrom
test/vue-query-mutationOptions-add-getter-type-tests
Apr 13, 2026
Merged

test(vue-query/mutationOptions): add type tests for getter overloads#10466
sukvvon merged 2 commits intomainfrom
test/vue-query-mutationOptions-add-getter-type-tests

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 13, 2026

🎯 Changes

  • Add 3 type tests for mutationOptions getter overloads:
    • should error if mutationFn return type mismatches TData (getter): verifies @ts-expect-error works correctly with getter overloads
    • should infer all types when not explicitly provided (getter): verifies return type is () => WithRequired<...> / () => Omit<...>
    • should work when used with useMutation (getter): verifies getter can be passed directly to useMutation

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Enhanced TypeScript type validation for mutation options, improving compile-time type safety verification for getter overload patterns.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 804d3419-30ca-401f-a617-3debd3bd4f9a

📥 Commits

Reviewing files that changed from the base of the PR and between 24de260 and 0976051.

📒 Files selected for processing (1)
  • packages/vue-query/src/__tests__/mutationOptions.test-d.ts

📝 Walkthrough

Walkthrough

Type-test coverage expanded for the mutationOptions getter overload in Vue Query. Three new TypeScript test cases validate type inference, error handling for mismatched generic parameters, and correct data typing in mutation usage scenarios.

Changes

Cohort / File(s) Summary
Type Tests for mutationOptions Getter
packages/vue-query/src/__tests__/mutationOptions.test-d.ts
Added three new type-test cases validating the getter overload: type mismatch detection with ts-expect-error, function option type inference, and data type correctness in useMutation integration (+52 lines).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A getter's dance, now types align,
Inference tested, error divine,
Three new tests hop through the flow,
Type safety's glow, watch it grow!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding type tests for getter overloads in the mutationOptions test file.
Description check ✅ Passed The description follows the template structure, includes detailed change descriptions, and has all required checklist items completed with appropriate selections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/vue-query-mutationOptions-add-getter-type-tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 0976051

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 1m 36s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-13 01:01:54 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@sukvvon sukvvon self-assigned this Apr 13, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 13, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10466

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10466

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10466

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10466

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10466

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10466

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10466

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10466

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10466

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10466

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10466

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10466

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10466

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10466

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10466

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10466

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10466

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10466

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10466

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10466

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10466

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10466

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10466

commit: 0976051

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.99 KB (0%)
react minimal 9.02 KB (0%)

@sukvvon sukvvon merged commit 6384368 into main Apr 13, 2026
8 checks passed
@sukvvon sukvvon deleted the test/vue-query-mutationOptions-add-getter-type-tests branch April 13, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant