Skip to content

test(svelte-query): replace inline props types with 'type Props', remove 'any', and add explicit generics#10448

Merged
sukvvon merged 1 commit intomainfrom
test/svelte-query-improve-type-clarity
Apr 11, 2026
Merged

test(svelte-query): replace inline props types with 'type Props', remove 'any', and add explicit generics#10448
sukvvon merged 1 commit intomainfrom
test/svelte-query-improve-type-clarity

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 11, 2026

🎯 Changes

  • Replace inline props types with type Props across 16 Svelte test components
  • Remove any types:
    • OnSuccessExample: onSuccessMock: any(data: number) => void, onSettledMock: any(data: number | undefined) => void
    • useMutationState/SelectExample: MutationStateOptions<any>MutationStateOptions<string>
  • Add explicit generics to CreateMutationOptions:
    • mutationOptions/BaseExample, MultiExample: CreateMutationOptionsCreateMutationOptions<string>
    • useMutationState/BaseExample, SelectExample: CreateMutationOptionsCreateMutationOptions<string>
  • Remove unnecessary | undefined from optional prop type in useMutationState/BaseExample

✅ 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

  • Refactor
    • Reorganized and consolidated internal component type definitions across the test suite for improved code clarity and better maintainability.
    • Refined and enhanced type specifications for mutation and query operations in test examples, providing clearer and more accurate type information.
    • Updated generic type parameters in options objects to improve type safety and precision in test component implementations.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 11, 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: 8a9f2adf-dac8-48c5-9497-988032cfe3d0

📥 Commits

Reviewing files that changed from the base of the PR and between 1881109 and e4254a5.

📒 Files selected for processing (16)
  • packages/svelte-query/tests/HydrationBoundary/BaseExample.svelte
  • packages/svelte-query/tests/QueryClientProvider/BaseExample.svelte
  • packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte
  • packages/svelte-query/tests/createInfiniteQuery/ChangeClientExample.svelte
  • packages/svelte-query/tests/createInfiniteQuery/SelectExample.svelte
  • packages/svelte-query/tests/createMutation/FailureExample.svelte
  • packages/svelte-query/tests/createMutation/OnSuccessExample.svelte
  • packages/svelte-query/tests/createMutation/ResetExample.svelte
  • packages/svelte-query/tests/createQueries/IsRestoringExample.svelte
  • packages/svelte-query/tests/createQuery/IsRestoringExample.svelte
  • packages/svelte-query/tests/mutationOptions/BaseExample.svelte
  • packages/svelte-query/tests/mutationOptions/MultiExample.svelte
  • packages/svelte-query/tests/useIsFetching/BaseExample.svelte
  • packages/svelte-query/tests/useIsMutating/BaseExample.svelte
  • packages/svelte-query/tests/useMutationState/BaseExample.svelte
  • packages/svelte-query/tests/useMutationState/SelectExample.svelte

📝 Walkthrough

Walkthrough

Refactored $props() type annotations across 17 test components in svelte-query by replacing inline object types with named Props type aliases. Additionally tightened generic type parameters in mutation options and state components for more explicit typing.

Changes

Cohort / File(s) Summary
Inline to Named Props Type Refactoring
packages/svelte-query/tests/HydrationBoundary/BaseExample.svelte, packages/svelte-query/tests/QueryClientProvider/BaseExample.svelte, packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte, packages/svelte-query/tests/createInfiniteQuery/ChangeClientExample.svelte, packages/svelte-query/tests/createInfiniteQuery/SelectExample.svelte, packages/svelte-query/tests/createMutation/FailureExample.svelte, packages/svelte-query/tests/createMutation/ResetExample.svelte, packages/svelte-query/tests/createQueries/IsRestoringExample.svelte, packages/svelte-query/tests/createQuery/IsRestoringExample.svelte, packages/svelte-query/tests/useIsFetching/BaseExample.svelte, packages/svelte-query/tests/useIsMutating/BaseExample.svelte
Replaced inline $props() destructuring type annotations with explicit type Props declarations. Destructuring assignments now reference the named type instead of inline object type literals.
Props Type Refactoring with Generic Parameterization
packages/svelte-query/tests/mutationOptions/BaseExample.svelte, packages/svelte-query/tests/mutationOptions/MultiExample.svelte, packages/svelte-query/tests/useMutationState/BaseExample.svelte, packages/svelte-query/tests/useMutationState/SelectExample.svelte
Introduced named Props types and tightened generic type parameters in CreateMutationOptions from unparameterized/any forms to explicitly CreateMutationOptions<string>. Mutation options now have stricter type constraints.
Explicit Function Type Signatures
packages/svelte-query/tests/createMutation/OnSuccessExample.svelte
Replaced untyped any callback parameters with explicit function signatures: onSuccessMock: (data: number) => void and onSettledMock: (data: number | undefined) => void.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

package: svelte-query

Poem

🐰 Props refactored neat and clean,
Named types shine where inlines had been,
Generic strings now strictly bound,
Type safety all throughout the ground!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: refactoring inline props types to named type Props across test components while removing any types and adding explicit generics.
Description check ✅ Passed The description follows the template structure with all required sections: detailed 🎯 Changes, completed ✅ Checklist, and 🚀 Release Impact. All key modifications are documented with specific examples.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/svelte-query-improve-type-clarity

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

@sukvvon sukvvon self-assigned this Apr 11, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 11, 2026

View your CI Pipeline Execution ↗ for commit e4254a5

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

☁️ Nx Cloud last updated this comment at 2026-04-11 07:38:54 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 11, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: e4254a5

@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 ee5b574 into main Apr 11, 2026
10 checks passed
@sukvvon sukvvon deleted the test/svelte-query-improve-type-clarity branch April 11, 2026 07:44
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