Skip to content

fix(vue-query): export queryOptions declaration types - #11098

Open
ousamabenyounes wants to merge 1 commit into
TanStack:mainfrom
ousamabenyounes:fix/issue-11042
Open

ousamabenyounes wants to merge 1 commit into
TanStack:mainfrom
ousamabenyounes:fix/issue-11042

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Changes

Completes the remaining part of #11042. The declaration-emit / name-collision core was already fixed on main by #11224 (*WithDataTag return types + QueryKeyWithDataTag), so this PR was rebased and reduced to the piece #11224 did not deliver: the supporting types that the public queryOptions signature references are now re-exported from the package roots.

  • @tanstack/vue-query: export ShallowOption and MaybeRefOrGetter.
  • @tanstack/query-core: export QueryBehavior, RetryValue, RetryDelayValue.

The earlier competing QueryOptionsDataTag design and the useQuery export renames were dropped: they conflicted irreconcilably with the merged *WithDataTag design and would have reintroduced a name collision. No runtime code changes; type-only, additive re-exports.

Fixes #11042

✅ Test verification (RED → GREEN)

Added publicTypeExports.test-d.ts to both packages asserting the new symbols are reachable from the package root (vitest --typecheck).

RED — on the reduced branch with the two re-export lines removed:

FAIL |@tanstack/query-core| publicTypeExports.test-d.ts
  Module '".."' has no exported member 'QueryBehavior'.
  Module '".."' has no exported member 'RetryDelayValue'.
  Module '".."' has no exported member 'RetryValue'.
FAIL |@tanstack/vue-query| publicTypeExports.test-d.ts
  Module '".."' has no exported member 'MaybeRefOrGetter'.
  Module '".."' has no exported member 'ShallowOption'.

GREEN — with the re-exports:

|@tanstack/query-core|  Test Files 1 passed (1)  Type Errors no errors
|@tanstack/vue-query|   Test Files 1 passed (1)  Type Errors no errors

Also green locally: test:types (query-core, vue-query, across TS 5.7–7.0), test:eslint (both), and prettier --check on the diff.

🚀 Release Impact

  • Changeset added (patch for @tanstack/query-core and @tanstack/vue-query).

Summary by CodeRabbit

  • New Features

    • Expanded the public type exports for query-core and Vue Query, including query behavior, retry, shallow option, and reactive value types. These types can now be imported from the package roots and used in downstream TypeScript declarations.
  • Tests

    • Added type-level checks to verify the new exports are available.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: TanStack/query/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 509cbd1b-8042-4b10-b9a3-bf69852e8aa6

📥 Commits

Reviewing files that changed from the base of the PR and between 0f59482 and d8e00a7.

📒 Files selected for processing (5)
  • .changeset/export-queryoptions-support-types.md
  • packages/query-core/src/__tests__/publicTypeExports.test-d.ts
  • packages/query-core/src/index.ts
  • packages/vue-query/src/__tests__/publicTypeExports.test-d.ts
  • packages/vue-query/src/index.ts

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


📝 Walkthrough

Walkthrough

Query Core and Vue Query now re-export supporting types from their package roots. New type-level tests check these exports, and a changeset records patch releases for both packages.

Changes

Query options supporting public types

Layer / File(s) Summary
Supporting type exports
packages/query-core/src/index.ts, packages/vue-query/src/index.ts, .changeset/export-queryoptions-support-types.md
The package roots re-export RetryDelayValue, RetryValue, QueryBehavior, MaybeRefOrGetter, and ShallowOption. The changeset records patch releases for both packages.
Type export validation
packages/query-core/src/__tests__/publicTypeExports.test-d.ts, packages/vue-query/src/__tests__/publicTypeExports.test-d.ts
Type-level tests check that the exported helper types resolve to non-never types.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: spaansba

Merge Risk: ⚪ Minimal · up to d8e00

The supporting types are available through the package roots, and no actionable merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address [#11042]. Query Core now exports QueryBehavior, RetryValue, and RetryDelayValue. Vue Query now exports MaybeRefOrGetter and ShallowOption. The current Vue Query root also…
Out of Scope Changes check ✅ Passed All changed files support [#11042]. The changes add public type exports, regression tests for those exports, and a patch changeset. No unrelated runtime behavior or unrelated package changes are prese…
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 4…
Title check ✅ Passed The title clearly identifies the Vue Query declaration-type export fix. It does not mention the matching Query Core exports, but it accurately describes the primary change.
Description check ✅ Passed The description explains the motivation, lists the Vue Query and Query Core exports, documents test results, references the issue, and confirms the changeset. It provides sufficient information for th…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/vue-query/src/queryOptions.ts`:
- Around line 68-71: Update QueryOptionsDataTag so its queryKey property
preserves the reactive MaybeRefOrGetter<TQueryKey> shape while retaining the
DataTag<TQueryKey, TQueryFnData, TError> metadata. Keep the existing omission
and tagging behavior unchanged, ensuring refs and getters remain valid in the
returned options type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 668e95eb-d1d5-4dcf-8b09-09a6b78764aa

📥 Commits

Reviewing files that changed from the base of the PR and between 86bb8a6 and d29124e.

📒 Files selected for processing (5)
  • .changeset/calm-vue-query-options.md
  • packages/query-core/src/index.ts
  • packages/vue-query/src/__tests__/queryOptions.test-d.ts
  • packages/vue-query/src/index.ts
  • packages/vue-query/src/queryOptions.ts

Comment thread packages/vue-query/src/queryOptions.ts Outdated
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

Re-export the helper types that the public queryOptions signature depends
on but that were unreachable from the package roots: ShallowOption and
MaybeRefOrGetter from @tanstack/vue-query, and QueryBehavior, RetryValue,
RetryDelayValue from @tanstack/query-core. The declaration-emit / name
collision core of TanStack#11042 was already fixed by TanStack#11224; this completes the
remaining unexported-supporting-types part.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ousamabenyounes

Copy link
Copy Markdown
Contributor Author

Rebased onto main and resolved the conflict by reducing scope: #11224 already merged the declaration-emit fix (*WithDataTag), so I dropped the competing QueryOptionsDataTag design and the useQuery export renames (they conflicted irreconcilably and re-introduced the name collision). What remains is the part #11224 left undone — re-exporting the helper types #11042 lists: ShallowOption/MaybeRefOrGetter (vue-query) and QueryBehavior/RetryValue/RetryDelayValue (query-core).

Verified locally: new publicTypeExports.test-d.ts in both packages goes RED (has no exported member) without the re-exports and GREEN with them; test:types (TS 5.7–7.0), test:eslint, and prettier all pass on the diff. Branch is now mergeable. Open: awaiting CodeRabbit re-review and CI on the new SHA.

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.

vue-query: queryOptions()'s real return type is unexported; the public name with the same identifier points at a different, legacy type

1 participant