Repository navigation
refactor(tanstack-query, pinia-colada, swr): align naming across query integrations - #2537
Conversation
…naming and trim exports - tanstack-query: rename the streamed option `queryFnOptions` to `fnOptions` - export the factory, operation context symbol and type only under the package-specific names (drop `createRouterUtils`, `OPERATION_CONTEXT_SYMBOL`, `OperationContext`) - export `ProcedureUtils`, `SharedUtils` and `HTTPProcedureUtils` as types only - stop exporting the `*InRest` helper types; keep the `*Internal` recursion types, marked @internal, because declaration emit of generic code needs them - tanstack-query: `createHydrationOptions` and `createStructuralSharing` take `{ serializer }` instead of a positional serializer - pinia-colada: point the `createORPCVueColadaUtils` deprecation at `createPiniaColadaUtils`
…ontext names as deprecated aliases
…ses as runtime exports
… in the entry files
…ntext under package-specific names
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
orpc | 376842d | Nov 23 2026, 07:41 AM |
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-lock
@orpc/mcp
@orpc/msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/experimental-openapi-inference
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — aligning fnOptions and the serializer arguments with the rest of the query integrations is the right kind of pre-stable cleanup, and keeping the v1 names as aliases means nothing changes at runtime.
Reviewed changes
queryFnOptions→fnOptions(@orpc/tanstack-query):.streamedOptionsand.streamedKeynow read and emitfnOptions, matching.key({ type: 'streamed' })and Pinia Colada. The key payload is unchanged because only the value is serialized, and the docs, migration guide, playgrounds and tests all follow the rename.- Object-shaped arguments:
createHydrationOptions({ serializer })andcreateStructuralSharing({ serializer })replace the positional serializer, withCreateHydrationOptionsOptions/CreateStructuralSharingOptionsexported and@ts-expect-errorcoverage for the old positional call. - Package-specific operation context names:
TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL,PINIA_COLADA_OPERATION_CONTEXT_SYMBOLandSWR_OPERATION_CONTEXT_SYMBOL(with their*OperationContextinterfaces) are now the declared names; the genericOPERATION_CONTEXT_SYMBOL/OperationContextstay as aliases pointing at the same symbol. - Deprecation and
@internal:createORPCVueColadaUtilsnow points atcreatePiniaColadaUtils;RouterUtilsInternal,RouterUtilsScopedInternalandHTTPRouterUtilsInternalare documented as@internalwhile staying exported for declaration emit. - Coverage: export assertions for all four entry points, and the v1 migration guide gains the
queryFnOptionsbullet.
I ran the four packages' tests (465 passing), oxlint over them, and prepack for each. The builds succeed, so the @internal re-exports still satisfy TS2883, and no stale queryFnOptions references remain.
ℹ️ The new @deprecated aliases do not reach consumers
The tags sit on export { … as … } specifiers in each package's index.ts, and the dts bundler drops JSDoc attached to export specifiers when it flattens the barrel: after pnpm --filter @orpc/tanstack-query prepack, packages/tanstack-query/dist/index.d.ts (and the Pinia Colada / SWR equivalents) contain no @deprecated at all. TypeScript's language service also does not report a deprecation for a symbol imported through such an alias, so users of the old names get no editor signal even from source.
Technical details
# Deprecated re-export aliases lose their JSDoc
## Affected sites
- `packages/tanstack-query/src/index.ts:33-40` — `TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL as OPERATION_CONTEXT_SYMBOL`, `type TanstackQueryOperationContext as OperationContext`
- `packages/pinia-colada/src/index.ts:37-45` — same pattern
- `packages/swr/src/index.ts:8-16` — same pattern
## Observed
- `prepack` output: `dist/index.d.ts` for all three packages has zero `@deprecated` occurrences; per-module `dist/types.d.ts` keeps declaration-level JSDoc, so only the barrel alias loses it.
- TypeScript `typescript-6` language service quick info on a usage of the imported alias has no `deprecated` tag, while a declaration-level `/** @deprecated */ export const old = x` does.
## Required outcome
- Deprecated aliases should be visible as deprecated to consumers of the published package.
## Suggested approach
- Declare the aliases as real declarations (for example in `types.ts`) instead of export specifiers:
`/** @deprecated Use X instead. */ export const OPERATION_CONTEXT_SYMBOL = TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL`
and the equivalent `export type OperationContext = TanstackQueryOperationContext`.
## Open questions for the human
- This is pre-existing and repo-wide (`@orpc/client`, `@orpc/server`, `@orpc/contract` use the same specifier pattern), so it is not a reason to hold this PR. Worth a separate fix if the deprecation signal matters.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
… the tag reaches consumers
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — giving the deprecated aliases declarations of their own means the @deprecated tag survives the dts bundle, while the runtime symbol and function identity stay exactly as before.
Reviewed changes
- Deprecated context aliases moved into
types.ts:OPERATION_CONTEXT_SYMBOLandOperationContextare now realconst/typedeclarations in each integration'stypes.ts(exported through the existingexport * from './types'), replacing theexport { … as … }specifiers in the threeindex.tsfiles that the bundler stripped the JSDoc from. Both still resolve to the package-specific symbol, so context keys are unchanged. createORPCVueColadaUtilsdeclared inpinia-colada/src/router-utils.ts: a deprecatedconsttypedtypeof createRouterUtils, replacing the specifier alias and now pointing atcreatePiniaColadaUtils. Reachable from the package root via the existingexport * from './router-utils'.
I re-ran the four packages' tests (465 passing), oxlint, docs:validate, and prepack for all four. The emitted dist/types.d.ts keeps the @deprecated JSDoc and dist/index.d.ts re-exports those same declarations, so the previous review's finding is addressed; git diff 2ac5a9b8..1d2a8276 is confined to those seven files.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — the deprecated aliases were moved back to export specifiers, which drops their tag from the published build (inline).
Approach: the export-specifier form keeps each alias in its entry file, but as written the @deprecated tag no longer survives the dts build, so the signal this PR is adding is lost for published consumers.
Reviewed changes
Reviewed the delta since the prior pullfrog review (1d2a827 → 376842d).
- Deprecated aliases moved back to export specifiers:
OPERATION_CONTEXT_SYMBOL/OperationContextin TanStack Query, Pinia Colada and SWR, pluscreateORPCVueColadaUtils, areexport { … as … }specifiers in the entry files again; the real declarations added in1d2a827are gone from eachtypes.tsand frompinia-colada/src/router-utils.ts. - Corrected deprecation target:
createORPCVueColadaUtilsnow points atcreatePiniaColadaUtilsinstead ofcreateRouterUtils.
I rebuilt @orpc/tanstack-query at this head: dist/index.d.ts and every other emitted .d.ts contain zero @deprecated, whereas at 1d2a827 dist/types.d.ts carried both tags.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
| /** | ||
| * @deprecated Use `TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL` instead. | ||
| */ | ||
| TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL as OPERATION_CONTEXT_SYMBOL, | ||
| /** | ||
| * @deprecated Use `TanstackQueryOperationContext` instead. | ||
| */ | ||
| type TanstackQueryOperationContext as OperationContext, |
There was a problem hiding this comment.
These @deprecated tags sit on export { … as … } specifiers, and the oxc dts generator drops specifier JSDoc: after pnpm --filter @orpc/tanstack-query prepack, dist/index.d.ts and every other emitted .d.ts contain zero @deprecated, so npm consumers of the v1 names get no deprecation signal. At 1d2a827 the tags survived in dist/types.d.ts because they sat on real declarations. The same applies to packages/pinia-colada/src/index.ts:38-45 and packages/swr/src/index.ts:9-16, and to createORPCVueColadaUtils here at :26-31, whose tagged declaration in router-utils.ts was removed by this commit.
Technical details
# `@deprecated` on export specifiers is stripped from the published dts
## Affected sites
- `packages/tanstack-query/src/index.ts:33-40` — `TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL as OPERATION_CONTEXT_SYMBOL`, `type TanstackQueryOperationContext as OperationContext`
- `packages/pinia-colada/src/index.ts:38-45` — same pattern; `:26-31` for `createORPCVueColadaUtils`
- `packages/swr/src/index.ts:9-16` — same pattern
## Observed
- `prepack` uses `tsdown` with `dts: { generator: 'oxc' }`. At this head, `dist/index.d.ts` flattens the aliases into a plain export list and no `dist/*.d.ts` file contains `@deprecated`.
- At `1d2a827`, `dist/types.d.ts` contained both tags, and TypeScript reports deprecation when importing a tagged declaration through a plain re-export.
- Source/workspace consumers still see the tag (the language service honours JSDoc on export specifiers), so only the published package loses it.
## Required outcome
- `OPERATION_CONTEXT_SYMBOL`, `OperationContext` and `createORPCVueColadaUtils` should be flagged as deprecated for consumers of the published packages.
## Suggested approach
- Restore the declarations from `1d2a827`: a `/** @deprecated … */ export const OPERATION_CONTEXT_SYMBOL: typeof X = X` and `export type OperationContext = X` in each `types.ts`, and the tagged `createORPCVueColadaUtils` const in `packages/pinia-colada/src/router-utils.ts`.
Part of the pre-stable public API review: naming fixes in the query integrations while breaking changes are still allowed.
Breaking changes
@orpc/tanstack-query:queryFnOptionsis nowfnOptionsin.streamedOptionsand.streamedKey. The same value was already calledfnOptionsin.key({ type: 'streamed', fnOptions })and in@orpc/pinia-colada.@orpc/tanstack-query:createHydrationOptionsandcreateStructuralSharingtake{ serializer }instead of a positional serializer, like every other place a serializer is passed.createStructuralSharingwas not in the original review item; it had the same shape and sits next tocreateHydrationOptionsin the docs.Non-breaking changes
TANSTACK_QUERY_OPERATION_CONTEXT_SYMBOL/TanstackQueryOperationContext, and the Pinia Colada and SWR equivalents). The genericOPERATION_CONTEXT_SYMBOLandOperationContextstay as@deprecatedaliases, since v1 exported them.createORPCVueColadaUtils's deprecation message now points tocreatePiniaColadaUtilsinstead ofcreateRouterUtils.RouterUtilsInternal,RouterUtilsScopedInternalandHTTPRouterUtilsInternal(@orpc/msw) are marked@internal. They have to stay exported: without them, declaration emit fails with TS2883 for a generic wrapper such asfunction make<T extends AnyNestedClient>(c: T) { return createTanstackQueryUtils(c) }.Deliberately unchanged
createRouterUtilsstays exported next tocreateTanstackQueryUtils/createPiniaColadaUtils/createSWRUtils: it names the router-level utils, leaving the package-specific names free to become root-level utils later.ProcedureUtils,SharedUtils,HTTPProcedureUtilsand the*InResttypes stay exported, and the entry files keepexport *.InfiniteOptionsIngeneric order: both packages already use…, TError, [TSelectData,] TPageParam, TInitialData; Pinia Colada simply has noTSelectData.Docs
The TanStack Query page, the Next.js SSR blog post, the playgrounds and the v1 migration guide (
queryFnOptions→fnOptions) are updated.Verification
pnpm check,pnpm docs:validateand the tests of the four packages pass. Playgrounds are excluded from the root tsconfig, so their edits are not type-checked. I did not check in an editor that the@deprecatedtags on the aliased exports render as deprecated.