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 4 commits into
mainfrom
fix/angular-injectquery-skiptoken-getter-typecheck
Draft

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

Conversation

@sukvvon

@sukvvon sukvvon commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

injectQuery's whole-options getter (injectQuery(() => ({ ... }))) fails to type-check the queryFn: cond ? fn : skipToken pattern. SkipToken is a unique symbol, and inside the getter's body the ternary's skipToken branch is widened to plain symbol, which then matches no injectQuery overload.

  • CreateQueryOptions (types.ts) now accepts symbol for queryFn, following the existing SkipTokenForUseQueries precedent in vue-query's useQueries.ts. To replace the queryFn property, it changes from an interface to a type alias over OmitKeyof<CreateBaseQueryOptions, 'suspense' | 'queryFn'>.
  • queryOptions()'s UndefinedInitialDataOptions overload (query-options.ts) narrows queryFn back to QueryFunction | SkipToken in its return type, so the widened symbol does not leak to callers.
  • UnusedSkipTokenOptions['queryFn'] is now QueryFunction directly, since Exclude<..., SkipToken | undefined> no longer filters out the widened symbol.
  • injectQuery's implementation casts its options getter to () => CreateBaseQueryOptions when calling createBaseQuery, which still expects the narrow type.

Type-only fix; no runtime behavior changes.

Tests:

  • inject-query.test-d.ts: data narrows to string | undefined for a conditional skipToken inside a whole-options getter.
  • inject-query.test.ts: the query does not fetch while queryFn is skipToken, and fetches once it is replaced.
  • query-options.test-d.ts: UnusedSkipTokenOptions still rejects skipToken.

✅ 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 have followed the AI contribution policy and 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 2185839

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

☁️ Nx Cloud last updated this comment at 2026-09-26 03:06:20 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

14 package(s) bumped directly, 11 bumped as dependents.

🟥 Major bumps

Package Version Reason
@tanstack/angular-query-experimental 5.103.3 → 6.0.0 Changeset
@tanstack/eslint-plugin-query 5.103.3 → 6.0.0 Changeset
@tanstack/query-broadcast-client-experimental 5.103.3 → 6.0.0 Changeset
@tanstack/query-core 5.103.3 → 6.0.0 Changeset
@tanstack/query-devtools 5.103.3 → 6.0.0 Changeset
@tanstack/react-query 5.103.3 → 6.0.0 Changeset
@tanstack/react-query-devtools 5.103.3 → 6.0.0 Changeset
@tanstack/react-query-next-experimental 5.103.3 → 6.0.0 Changeset
@tanstack/react-query-persist-client 5.103.3 → 6.0.0 Changeset
@tanstack/svelte-query 6.2.5 → 7.0.0 Changeset
@tanstack/svelte-query-devtools 6.2.5 → 7.0.0 Changeset
@tanstack/svelte-query-persist-client 6.2.5 → 7.0.0 Changeset
@tanstack/vue-query 5.103.3 → 6.0.0 Changeset
@tanstack/vue-query-devtools 6.2.5 → 7.0.0 Changeset
@tanstack/angular-query-persist-client 5.103.3 → 6.0.0 Dependent
@tanstack/lit-query 0.2.24 → 1.0.0 Dependent
@tanstack/preact-query 5.103.3 → 6.0.0 Dependent
@tanstack/preact-query-devtools 5.103.3 → 6.0.0 Dependent
@tanstack/preact-query-persist-client 5.103.3 → 6.0.0 Dependent
@tanstack/query-async-storage-persister 5.103.3 → 6.0.0 Dependent
@tanstack/query-persist-client-core 5.103.3 → 6.0.0 Dependent
@tanstack/query-sync-storage-persister 5.103.3 → 6.0.0 Dependent
@tanstack/solid-query 5.103.3 → 6.0.0 Dependent
@tanstack/solid-query-devtools 5.103.3 → 6.0.0 Dependent
@tanstack/solid-query-persist-client 5.103.3 → 6.0.0 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: fbb858a

@github-actions

github-actions Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.73 KB (0%)
react minimal 8.58 KB (0%)

sukvvon and others added 2 commits September 26, 2026 12:01
…ry-skiptoken-getter-typecheck

# Conflicts:
#	packages/angular-query-experimental/src/__tests__/query-options.test-d.ts

This branch has not been deployed

No deployments
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