Conversation
…nce and callbacks
📝 WalkthroughWalkthroughAdded a new TypeScript declaration test file for the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit adb0185
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
size-limit report 📦
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/solid-query/src/__tests__/useMutation.test-d.tsx (2)
82-89: Optional cleanup: deduplicate repeatedCustomErrordeclaration.Line 82–89 and Line 109–116 duplicate the same local class. Consider lifting a single shared
CustomErrortest helper in this file to reduce repetition.Also applies to: 109-116
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/solid-query/src/__tests__/useMutation.test-d.tsx` around lines 82 - 89, Define a single shared CustomError class once in this test file and reuse it in both tests instead of declaring it twice; remove the local duplicate declarations in the two test cases (the class named CustomError used in the "should infer custom TError type" test and the other test) and place one top-level class declaration (or a helper factory) near the other test helpers so both tests import/consume the same CustomError symbol.
99-105: Consider asserting allonSettledparams for full callback coverage.Line 99–105 already checks
dataanderror; adding assertions for_variablesand_onMutateResultwould make this callback test fully symmetrical with the PR objective.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/solid-query/src/__tests__/useMutation.test-d.tsx` around lines 99 - 105, The test for useMutation's onSettled callback only asserts types for data and error; add type assertions for the remaining parameters by checking _variables and _onMutateResult inside the onSettled callback to ensure full coverage: assert _variables has the expected variables type (likely void or the mutation variables type used by mutationFn) and assert _onMutateResult matches the onMutate return type (e.g., unknown or specific type), referencing the useMutation call and the onSettled parameter names (_variables, _onMutateResult) when adding these expectTypeOf checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/solid-query/src/__tests__/useMutation.test-d.tsx`:
- Around line 82-89: Define a single shared CustomError class once in this test
file and reuse it in both tests instead of declaring it twice; remove the local
duplicate declarations in the two test cases (the class named CustomError used
in the "should infer custom TError type" test and the other test) and place one
top-level class declaration (or a helper factory) near the other test helpers so
both tests import/consume the same CustomError symbol.
- Around line 99-105: The test for useMutation's onSettled callback only asserts
types for data and error; add type assertions for the remaining parameters by
checking _variables and _onMutateResult inside the onSettled callback to ensure
full coverage: assert _variables has the expected variables type (likely void or
the mutation variables type used by mutationFn) and assert _onMutateResult
matches the onMutate return type (e.g., unknown or specific type), referencing
the useMutation call and the onSettled parameter names (_variables,
_onMutateResult) when adding these expectTypeOf checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8c847047-c406-4e54-b514-280edc55be52
📒 Files selected for processing (1)
packages/solid-query/src/__tests__/useMutation.test-d.tsx
🎯 Changes
Add type tests for
useMutationinsolid-query, covering all 4 generics (TData,TError,TVariables,TOnMutateResult), callback type inference (onSuccess,onError,onSettled,onMutate),mutate/mutateAsynctypes, andAccessor<QueryClient>second argument.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit