Skip to content

fix(angular-query-experimental): widen 'SkipToken' to 'symbol' so it type-checks inside a whole-options getter - #11434

Draft
sukvvon wants to merge 2 commits into
mainfrom
fix/angular-injectquery-skiptoken-getter-typecheck
Draft

fix(angular-query-experimental): widen 'SkipToken' to 'symbol' so it type-checks inside a whole-options getter#11434
sukvvon wants to merge 2 commits into
mainfrom
fix/angular-injectquery-skiptoken-getter-typecheck

Conversation

@sukvvon

@sukvvon sukvvon commented Sep 6, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Same root cause as #11427 (vue-query): injectQuery's whole-options getter overload (injectQuery(() => ({...}))) failed to type-check the queryFn: cond ? fn : skipToken pattern, because SkipToken is a unique symbol and TypeScript fails to propagate the contextual type into a ternary inside a getter's body when the function has multiple overloads — widening the ternary's unique symbol branch to plain symbol, which then matches no overload.

Applies the same fix verified in #11427: widen CreateQueryOptions's queryFn to accept symbol (parameter position), following the existing SkipTokenForUseQueries precedent in @tanstack/vue-query's useQueries.ts. Since CreateQueryOptions is also the basis of queryOptions()'s return type, the queryOptions() overload that could leak the widened symbol narrows queryFn back with OmitKeyof. UnusedSkipTokenOptions (which already existed here, unlike vue) is changed from Exclude<..., SkipToken | undefined> to a direct QueryFunction<...> type, since Exclude no longer filters out the widened symbol — verified with a new regression test that it still rejects skipToken.

injectQuery's implementation signature needed an explicit cast to CreateBaseQueryOptions when calling createBaseQuery, since that internal helper still expects the narrow (un-widened) type.

No runtime behavior changes — this is a type-only fix. Added a runtime test (should not fetch when queryFn is skipToken, and fetch once it is replaced) and a type test to inject-query.test.ts/inject-query.test-d.ts, matching the shape already used for injectInfiniteQuery's skipToken test.

injectInfiniteQuery's separate TPageParam inference gap (falls back to unknown with skipToken) is a related but distinct issue, not addressed here.

✅ 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).

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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 6, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 80dd43b

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

☁️ Nx Cloud last updated this comment at 2026-09-06 15:06:10 UTC

@sukvvon sukvvon self-assigned this Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

3 package(s) bumped directly, 22 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/svelte-query 6.1.48 → 6.2.0 Changeset
@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-devtools 6.1.48 → 6.2.0 Dependent

🟩 Patch bumps

Package Version Reason
@tanstack/angular-query-experimental 5.102.8 → 5.102.9 Changeset
@tanstack/query-core 5.102.8 → 5.102.9 Changeset
@tanstack/angular-query-persist-client 5.102.8 → 5.102.9 Dependent
@tanstack/eslint-plugin-query 5.102.8 → 5.102.9 Dependent
@tanstack/lit-query 0.2.20 → 0.2.21 Dependent
@tanstack/preact-query 5.102.8 → 5.102.9 Dependent
@tanstack/preact-query-devtools 5.102.8 → 5.102.9 Dependent
@tanstack/preact-query-persist-client 5.102.8 → 5.102.9 Dependent
@tanstack/query-async-storage-persister 5.102.8 → 5.102.9 Dependent
@tanstack/query-broadcast-client-experimental 5.102.8 → 5.102.9 Dependent
@tanstack/query-devtools 5.102.8 → 5.102.9 Dependent
@tanstack/query-persist-client-core 5.102.8 → 5.102.9 Dependent
@tanstack/query-sync-storage-persister 5.102.8 → 5.102.9 Dependent
@tanstack/react-query 5.102.8 → 5.102.9 Dependent
@tanstack/react-query-devtools 5.102.8 → 5.102.9 Dependent
@tanstack/react-query-next-experimental 5.102.8 → 5.102.9 Dependent
@tanstack/react-query-persist-client 5.102.8 → 5.102.9 Dependent
@tanstack/solid-query 5.102.8 → 5.102.9 Dependent
@tanstack/solid-query-devtools 5.102.8 → 5.102.9 Dependent
@tanstack/solid-query-persist-client 5.102.8 → 5.102.9 Dependent
@tanstack/vue-query 5.102.8 → 5.102.9 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: f77a39f

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

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

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