Skip to content

test(svelte-query): add 'assertType' and 'expectTypeOf' to type tests with no assertions#10450

Merged
sukvvon merged 2 commits intomainfrom
test/svelte-query-add-assertType-to-type-tests
Apr 11, 2026
Merged

test(svelte-query): add 'assertType' and 'expectTypeOf' to type tests with no assertions#10450
sukvvon merged 2 commits intomainfrom
test/svelte-query-add-assertType-to-type-tests

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 11, 2026

🎯 Changes

  • Add assertType to 2 type tests to make type validation explicitly expressed as test assertions:
    • infiniteQueryOptions.test-d.ts: "Should not allow excess properties"
    • queryOptions.test-d.ts: "Should not allow excess properties"
  • Replace assertType with expectTypeOf for initialData type validation in queryOptions.test-d.ts:
    • "Should allow undefined response in initialData": validates initialData return type is { id: string; title: string } | undefined

✅ 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
    • Strengthened type-level assertions in the test suite for query option behaviors by adopting explicit assertion checks.
    • Added an explicit assertion for the resolved initial-data type to prevent regressions.
    • No changes to public APIs or runtime behavior; purely test improvements.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

📝 Walkthrough

Walkthrough

Type-level test files updated to wrap queryOptions(...) and infiniteQueryOptions(...) calls with vitest's assertType(...); one test also adds an explicit expectTypeOf(...) assertion for initialData typing and retains an @ts-expect-error for an invalid property.

Changes

Cohort / File(s) Summary
Type assertion test updates
packages/svelte-query/tests/queryOptions.test-d.ts, packages/svelte-query/tests/infiniteQueryOptions.test-d.ts
Replaced direct queryOptions(...) / infiniteQueryOptions(...) call-site excess-property checks by wrapping returned values with vitest's assertType(...). Added an explicit expectTypeOf(...).toEqualTypeOf(...) check for initialData in queryOptions test; preserved @ts-expect-error for invalid stallTime.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰
I nibble types at break of day,
Wrapped in assertType, neat and fey.
A tiny test hop, clean and bright,
Types tuck in snug — and all feels right. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description follows the template structure with complete 🎯 Changes section, all checklist items addressed, and 🚀 Release Impact clearly marked as dev-only with no release needed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main change: adding explicit type assertions ('assertType' and 'expectTypeOf') to type tests that previously lacked assertions.

✏️ 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/svelte-query-add-assertType-to-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 11, 2026

View your CI Pipeline Execution ↗ for commit 83016fd

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

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

@sukvvon sukvvon self-assigned this Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 11, 2026

🚀 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@10450

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 83016fd

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 11, 2026

size-limit report 📦

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

@sukvvon sukvvon changed the title test(svelte-query): add 'assertType' to type tests with no assertions test(svelte-query): add 'assertType' and 'expectTypeOf' to type tests with no assertions Apr 11, 2026
@sukvvon sukvvon merged commit 3f56a86 into main Apr 11, 2026
8 checks passed
@sukvvon sukvvon deleted the test/svelte-query-add-assertType-to-type-tests branch April 11, 2026 08:51
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