Skip to content

test(angular-query/query-options): add type tests for 'getQueryState' and 'skipToken' inference - #11465

Open
sukvvon wants to merge 1 commit into
mainfrom
test/angular-query-options-test-d-parity
Open

test(angular-query/query-options): add type tests for 'getQueryState' and 'skipToken' inference#11465
sukvvon wants to merge 1 commit into
mainfrom
test/angular-query-options-test-d-parity

Conversation

@sukvvon

@sukvvon sukvvon commented Sep 10, 2026

Copy link
Copy Markdown
Member

🎯 Changes

angular-query-experimental's query-options.test-d.ts was missing three cases that react-query, preact-query, solid-query and svelte-query already cover in their queryOptions type tests. This ports them over.

  • should return the proper type when passed to getQueryState — asserts the tagged query key narrows state?.data to number | undefined. Placed right after the existing getQueryData case, matching where the other adapters put it.
  • should infer even if there is a conditional skipToken — a queryFn that is either skipToken or a real function still infers number | undefined.
  • should infer to unknown if we disable a query with just a skipToken — a queryFn that is only skipToken infers unknown.

Each one was checked by changing the input rather than the expected type: flipping the queryFn result type (or replacing skipToken with a real function) makes the corresponding assertion fail, so all three react to what they claim to test.

Type tests only — no runtime or published code is touched.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 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
    • Expanded TypeScript type coverage for query state and data retrieval.
    • Added validation that tagged queries expose optional numeric data types correctly.
    • Confirmed data type inference for conditionally skipped queries.
    • Added coverage for queries configured exclusively with a skip token, ensuring their data is typed as unknown.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b101a580-e1af-4458-853b-d2a4b3198420

📥 Commits

Reviewing files that changed from the base of the PR and between cb54331 and 73612c4.

📒 Files selected for processing (1)
  • packages/angular-query-experimental/src/__tests__/query-options.test-d.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The Angular type-test suite adds assertions for tagged query state and skipToken query data inference. It verifies number | undefined for tagged and conditional queries, and unknown for queries that use only skipToken.

Changes

Angular query type coverage

Layer / File(s) Summary
Query option inference assertions
packages/angular-query-experimental/src/__tests__/query-options.test-d.ts
Adds type assertions for tagged query state, conditional skipToken query functions, and exclusive skipToken query functions.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 73612

This change expands Angular query-option type coverage without changing runtime behavior or published implementation. No current merge-blocking risk is identified.

Suggested reviewers: tkdodo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the addition of Angular query-options type tests for getQueryState and skipToken inference. It is concise and accurately reflects the main changes.
Description check ✅ Passed The description includes the required Changes, Checklist, and Release Impact sections. It explains the three added type tests, records completed checklist items, and correctly marks the change as dev-…
✨ 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/angular-query-options-test-d-parity

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.

❤️ Share

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

@nx-cloud

nx-cloud Bot commented Sep 10, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 73612c4

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

☁️ Nx Cloud last updated this comment at 2026-09-10 01:34:45 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 10, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11465

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 73612c4

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.85 KB (0%)
react minimal 8.84 KB (0%)

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/query-core 5.102.8 → 5.103.0 Changeset
@tanstack/svelte-query 6.1.48 → 6.2.0 Changeset
@tanstack/angular-query-experimental 5.102.8 → 5.103.0 Dependent
@tanstack/angular-query-persist-client 5.102.8 → 5.103.0 Dependent
@tanstack/eslint-plugin-query 5.102.8 → 5.103.0 Dependent
@tanstack/preact-query 5.102.8 → 5.103.0 Dependent
@tanstack/preact-query-devtools 5.102.8 → 5.103.0 Dependent
@tanstack/preact-query-persist-client 5.102.8 → 5.103.0 Dependent
@tanstack/query-async-storage-persister 5.102.8 → 5.103.0 Dependent
@tanstack/query-broadcast-client-experimental 5.102.8 → 5.103.0 Dependent
@tanstack/query-devtools 5.102.8 → 5.103.0 Dependent
@tanstack/query-persist-client-core 5.102.8 → 5.103.0 Dependent
@tanstack/query-sync-storage-persister 5.102.8 → 5.103.0 Dependent
@tanstack/react-query 5.102.8 → 5.103.0 Dependent
@tanstack/react-query-devtools 5.102.8 → 5.103.0 Dependent
@tanstack/react-query-next-experimental 5.102.8 → 5.103.0 Dependent
@tanstack/react-query-persist-client 5.102.8 → 5.103.0 Dependent
@tanstack/solid-query 5.102.8 → 5.103.0 Dependent
@tanstack/solid-query-devtools 5.102.8 → 5.103.0 Dependent
@tanstack/solid-query-persist-client 5.102.8 → 5.103.0 Dependent
@tanstack/svelte-query-devtools 6.1.48 → 6.2.0 Dependent
@tanstack/svelte-query-persist-client 6.1.48 → 6.2.0 Dependent
@tanstack/vue-query 5.102.8 → 5.103.0 Dependent
@tanstack/vue-query-devtools 6.1.48 → 6.2.0 Dependent

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.20 → 0.2.21 Dependent

@sukvvon
sukvvon force-pushed the test/angular-query-options-test-d-parity branch from cb54331 to 73612c4 Compare September 10, 2026 01:28
@sukvvon sukvvon changed the title test(angular-query/query-options): add type tests for 'getQueryState', 'skipToken' inference, and 'QueriesObserver' test(angular-query/query-options): add type tests for 'getQueryState' and 'skipToken' inference Sep 10, 2026
@sukvvon sukvvon self-assigned this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant