Skip to content

fix(tanstack-query): narrow live options defaults type#1568

Merged
dinwwwh merged 1 commit into
middleapi:mainfrom
lyzno1:codex/fix-live-options-defaults-type
May 28, 2026
Merged

fix(tanstack-query): narrow live options defaults type#1568
dinwwwh merged 1 commit into
middleapi:mainfrom
lyzno1:codex/fix-live-options-defaults-type

Conversation

@lyzno1
Copy link
Copy Markdown
Contributor

@lyzno1 lyzno1 commented May 28, 2026

Summary

  • Narrow experimental_liveOptions defaults to QueryOptionsIn instead of StreamedOptionsIn
  • Add a type test ensuring streamed-only queryFnOptions is rejected for live defaults

Tests

  • pnpm --filter @orpc/tanstack-query type:check
  • pnpm vitest run packages/tanstack-query/src/procedure-utils.test.ts
  • pnpm run type:check
  • pnpm exec eslint --max-warnings=0 packages/tanstack-query/src/procedure-utils.ts packages/tanstack-query/src/procedure-utils.test-d.ts

Summary by CodeRabbit

  • Bug Fixes

    • Fixed type validation for the experimental live query feature to use correct type definitions and enforce requirements properly.
  • Tests

    • Added type assertions to ensure the experimental live query options correctly validate input and reject incompatible configurations.

Review Change Stack

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. javascript Pull requests that update javascript code labels May 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3db3c6db-cca1-4859-b62c-51853e0f5187

📥 Commits

Reviewing files that changed from the base of the PR and between 1378fd2 and 70f4103.

📒 Files selected for processing (2)
  • packages/tanstack-query/src/procedure-utils.test-d.ts
  • packages/tanstack-query/src/procedure-utils.ts

📝 Walkthrough

Walkthrough

This PR corrects the TypeScript type definition for the experimental_liveOptions property in experimental_ProcedureUtilsDefaults. The property type is changed from Partial<StreamedOptionsIn<...>> to Partial<QueryOptionsIn<...>>, and corresponding type test assertions are updated to validate the corrected type and ensure incompatible queryFnOptions are rejected.

Changes

Type Definition Correction

Layer / File(s) Summary
Type definition and test corrections
packages/tanstack-query/src/procedure-utils.ts, packages/tanstack-query/src/procedure-utils.test-d.ts
The experimental_liveOptions property type in the exported experimental_ProcedureUtilsDefaults interface is changed from Partial<StreamedOptionsIn<...>> to Partial<QueryOptionsIn<...>>. The type test assertion is updated to match the corrected type, and a new negative type assertion ensures queryFnOptions is rejected by experimental_liveOptions (since queryFnOptions is only supported by experimental_streamedOptions).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • middleapi/orpc#1260: Introduced experimental_ProcedureUtilsDefaults/experimental_defaults and its experimental_liveOptions default typing, which this PR corrects.
  • middleapi/orpc#721: Introduced live query options (.liveOptions/live query typing) in the same codebase area that this PR refines.

Suggested labels

size:M

Poem

🐰 A type was wandering down the wrong path,
Streaming when it should have queried instead!
With QueryOptionsIn set straight and test-d blessed,
The live options now flow with confidence true,
A small hop, but a mighty correction through. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: narrowing the type of experimental_liveOptions defaults from StreamedOptionsIn to QueryOptionsIn.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the type definition of experimental_liveOptions in procedure-utils.ts to accept Partial<QueryOptionsIn> instead of Partial<StreamedOptionsIn>. Additionally, the type tests in procedure-utils.test-d.ts have been updated to reflect this change, including a new test case verifying that queryFnOptions is correctly rejected. I have no feedback to provide as there are no review comments.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@1568

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@1568

@orpc/client

npm i https://pkg.pr.new/@orpc/client@1568

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@1568

@orpc/experimental-durable-iterator

npm i https://pkg.pr.new/@orpc/experimental-durable-iterator@1568

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@1568

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@1568

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@1568

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@1568

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@1568

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@1568

@orpc/otel

npm i https://pkg.pr.new/@orpc/otel@1568

@orpc/experimental-pino

npm i https://pkg.pr.new/@orpc/experimental-pino@1568

@orpc/experimental-publisher

npm i https://pkg.pr.new/@orpc/experimental-publisher@1568

@orpc/experimental-publisher-durable-object

npm i https://pkg.pr.new/@orpc/experimental-publisher-durable-object@1568

@orpc/experimental-ratelimit

npm i https://pkg.pr.new/@orpc/experimental-ratelimit@1568

@orpc/react

npm i https://pkg.pr.new/@orpc/react@1568

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@1568

@orpc/experimental-react-swr

npm i https://pkg.pr.new/@orpc/experimental-react-swr@1568

@orpc/server

npm i https://pkg.pr.new/@orpc/server@1568

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@1568

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@1568

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@1568

@orpc/standard-server-aws-lambda

npm i https://pkg.pr.new/@orpc/standard-server-aws-lambda@1568

@orpc/standard-server-fastify

npm i https://pkg.pr.new/@orpc/standard-server-fastify@1568

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@1568

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@1568

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@1568

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@1568

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@1568

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@1568

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@1568

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@1568

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@1568

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@1568

commit: 3f7d7d0

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

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

Reviewed changes — narrowed experimental_liveOptions defaults type from StreamedOptionsIn to QueryOptionsIn and added a type test rejecting streamed-only queryFnOptions.

  • procedure-utils.ts — changed experimental_ProcedureUtilsDefaults.experimental_liveOptions to use QueryOptionsIn instead of StreamedOptionsIn
  • procedure-utils.test-d.ts — updated test description and added @ts-expect-error assertion ensuring queryFnOptions is rejected for live defaults

✅ No new issues found.

Pullfrog  | View workflow run | Using Kimi K2𝕏

@dinwwwh dinwwwh merged commit 36cf381 into middleapi:main May 28, 2026
5 checks passed
@lyzno1 lyzno1 deleted the codex/fix-live-options-defaults-type branch May 28, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants