Skip to content

chore: type-check packages against composite-project declarations - #9033

Draft
schiller-manuel wants to merge 4 commits into
test/published-declaration-checkfrom
chore/composite-projects
Draft

schiller-manuel wants to merge 4 commits into
test/published-declaration-checkfrom
chore/composite-projects

Conversation

@schiller-manuel

Copy link
Copy Markdown
Collaborator

🎯 Changes

Stacked on #9032.

Packages get a second declaration set that sibling packages type-check against, in the structure TanStack Query uses (composite projects, references, an Nx compile target). Nothing published changes: all 2,803 files under packages/*/dist are byte-identical.

Why: the next pull requests tag undocumented internals @internal. Those leave dist, which users install, and stay visible to sibling packages through this set. Type checks also stop depending on Vite builds of dependencies.

  • Each package gets tsconfig.internal.json, a composite project that writes declarations with stripInternal: false to dist-ts, and a compile script (tsc6).
  • packages/tsconfig.paths.json maps every @tanstack/* entry point (117) to dist-ts. It is types only: the targets have no extension, so runtime resolvers that read tsconfig paths (Vite, jiti) find no JavaScript there and fall back to dist.
  • packages/tsconfig.base.json extends the root config and the map; every package tsconfig extends the base. The root tsconfig, examples, e2e projects and benchmarks are untouched and keep resolving to dist, like a user.
  • scripts/internal-types-config.mjs generates the map, the internal configs and the references, and checks that a package's imports of its own specifiers resolve to its source. Its test runs in the root test:unit and fails when generated files are stale.
  • Nx: new cached compile target ordered by ^compile. For packages/*, test:types and test:eslint depend on ^compile instead of builds; build and test:unit add ^compile.
  • react/solid/vue-start map their src/default-entry self-imports to source. A dead paths entry in solid-router-devtools is replaced by the map.
  • dist-ts is ignored by git, Prettier and ESLint and removed by clean. AGENTS.md describes compile and how to regenerate the map.

Measured: all 41 packages compile from clean in 14.6 s. With no dist anywhere, test:types for react-router needs only the compile of history and router-core (4.1 s).

Validated locally for packages/* without the Nx cache: build and compile (82 tasks), test:types, test:eslint, test:unit (154 tasks), test:build (108 tasks), plus one example and one e2e project build. Draft because it inherits the red test:build of #9032 until TanStack/config#443 is released.

Written with AI assistance (Claude Code).

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with the relevant test commands, or 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).

🤖 Generated with Claude Code

schiller-manuel and others added 4 commits November 30, 2026 02:17
Add scripts/internal-types-config.mjs, which resolves every `exports`
entry of every package the way TypeScript does and writes
packages/tsconfig.paths.json, a `paths` map from each `@tanstack/*`
specifier to the matching declaration in that package's `dist-ts`. The
targets have no `.d.ts` extension, so runtime resolvers that read
tsconfig `paths` (Vite's `resolve.tsconfigPaths`, jiti) find nothing
there and fall back to the published `exports`.

packages/tsconfig.base.json extends the root tsconfig and the map. The
root tsconfig stays as it is, so benchmarks, examples and e2e projects
keep resolving to `dist`.

The script also writes each package's tsconfig.internal.json and the
`references` lists, and checks that no package resolves its own
specifiers anywhere but its source. The root `test:unit` target runs
its test, which fails when a generated file is stale.

Ignore `dist-ts` in git, Prettier and ESLint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each package gets a generated tsconfig.internal.json: composite,
declarations only, `stripInternal: false`, `src` to `dist-ts`, with
`references` to the same file in each workspace dependency. A `compile`
script runs it with TypeScript 6, the version the Vite build's
declaration plugin emits with. `clean` also removes `dist-ts`.

Every package tsconfig now extends packages/tsconfig.base.json, so type
checks, the Vite build's declaration step, ESLint and the Vitest type
check read the dependencies' internal declarations. The published
`dist` is byte-identical. tsconfig.json lists the workspace
dependencies under `references` for editors.

The tsconfigs that define their own `paths` carry the generated map
next to their hand-written entries. react-start, solid-start and
vue-start map their `/client` and `/server` self-imports in
src/default-entry to source, which they read from their own `dist`
before. solid-router-devtools loses its `@tanstack/router-devtools-core`
entry: it pointed at a folder that does not exist, so TypeScript fell
back to the published declarations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a cached `compile` target default that depends on `^compile` and
outputs `{projectRoot}/dist-ts`. For projects under packages/,
`test:types` and `test:eslint` depend on `^compile` only and no longer
on any Vite build, `build` adds `^compile` because its declaration step
type-checks against the dependencies' internal set, and `test:unit`
adds `^compile` for the Vitest type check while keeping `^build` for
runtime. Examples, e2e projects and benchmarks keep their targets.
packages/tsconfig.base.json and the map join `sharedGlobals`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: dad27ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 30, 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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@nx-cloud

nx-cloud Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit dad27ea

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 8m 56s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 36s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-30 01:29:15 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.170.46 → 1.170.47 Changeset
@tanstack/react-router-devtools 1.167.4 → 1.167.5 Changeset
@tanstack/react-start-rsc 0.1.69 → 0.1.70 Changeset
@tanstack/router-core 1.171.39 → 1.171.40 Changeset
@tanstack/router-devtools-core 1.168.4 → 1.168.5 Changeset
@tanstack/router-plugin 1.170.0 → 1.170.1 Changeset
@tanstack/solid-router 1.170.43 → 1.170.44 Changeset
@tanstack/solid-router-devtools 1.167.4 → 1.167.5 Changeset
@tanstack/start-plugin-core 1.173.0 → 1.173.1 Changeset
@tanstack/vue-router 1.170.42 → 1.170.43 Changeset
@tanstack/vue-router-devtools 1.167.4 → 1.167.5 Changeset
@tanstack/react-start 1.170.0 → 1.170.1 Dependent
@tanstack/react-start-client 1.168.45 → 1.168.46 Dependent
@tanstack/react-start-server 1.167.52 → 1.167.53 Dependent
@tanstack/router-cli 1.168.1 → 1.168.2 Dependent
@tanstack/router-devtools 1.167.4 → 1.167.5 Dependent
@tanstack/router-generator 1.169.0 → 1.169.1 Dependent
@tanstack/router-vite-plugin 1.167.50 → 1.167.51 Dependent
@tanstack/solid-start 1.170.0 → 1.170.1 Dependent
@tanstack/solid-start-client 1.168.42 → 1.168.43 Dependent
@tanstack/solid-start-server 1.167.50 → 1.167.51 Dependent
@tanstack/start-client-core 1.170.39 → 1.170.40 Dependent
@tanstack/start-server-core 1.169.45 → 1.169.46 Dependent
@tanstack/start-static-server-functions 1.167.44 → 1.167.45 Dependent
@tanstack/start-storage-context 1.167.41 → 1.167.42 Dependent
@tanstack/vue-start 1.170.0 → 1.170.1 Dependent
@tanstack/vue-start-client 1.167.45 → 1.167.46 Dependent
@tanstack/vue-start-server 1.167.50 → 1.167.51 Dependent

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: a63d51d23a44
  • Measured at: 2026-11-30T01:21:14.062Z
  • Baseline source: history:a47dc36d0310
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

Scenario Current (gzip) Initial (gzip) Raw Brotli Trend
react-router.minimal 84.0 KiB
-15 B
83.9 KiB
-14 B
261.5 KiB
-25 B
73.3 KiB
-39 B
▁▆▆▆▆▆▆▆▆██▄
react-router.full 87.6 KiB
-16 B
87.5 KiB
-14 B
273.4 KiB
-25 B
76.4 KiB
-42 B
▁▆▆▆▆▆▆▆▆██▅
solid-router.minimal 33.4 KiB
-13 B
33.2 KiB
-12 B
95.3 KiB
-25 B
30.2 KiB
-43 B
▁██████████▆
solid-router.full 38.3 KiB
-14 B
38.1 KiB
-14 B
110.1 KiB
-25 B
34.6 KiB
+2 B
▁██████████▃
vue-router.minimal 49.5 KiB
-12 B
49.3 KiB
-11 B
136.5 KiB
-50 B
44.8 KiB
-8 B
▁██████████▆
vue-router.full 55.0 KiB
-15 B
54.9 KiB
-15 B
154.6 KiB
-50 B
49.7 KiB
-9 B
▁██████████▆
react-start.minimal 96.8 KiB
-10 B
96.7 KiB
-11 B
302.4 KiB
-25 B
84.1 KiB
-18 B
▁▅▅▅▅▅▅▅▅██▄
react-start.query-integration 104.2 KiB
-14 B
104.1 KiB
-12 B
329.0 KiB
-25 B
90.6 KiB
+53 B
▁▅▅▅▅▅▅▅▅██▄
react-start.deferred-hydration 97.5 KiB
-12 B
96.7 KiB
-11 B
303.8 KiB
-25 B
84.7 KiB
-130 B
▁▆▆▆▆▆▆▆▆██▆
react-start.full 99.9 KiB
-14 B
99.7 KiB
-14 B
311.7 KiB
-25 B
86.7 KiB
-27 B
▁▅▅▅▅▅▅▅▅██▄
react-start.rsbuild.minimal 96.7 KiB
-13 B
96.5 KiB
-13 B
298.3 KiB
-25 B
83.5 KiB
-26 B
▇█████████▅▁
react-start.rsbuild.minimal-iife 97.1 KiB
-14 B
96.9 KiB
-14 B
299.2 KiB
-25 B
83.7 KiB
-103 B
▆█████████▅▁
react-start.rsbuild.full 99.9 KiB
-13 B
99.8 KiB
-13 B
307.9 KiB
-25 B
86.2 KiB
+57 B
▇█████████▄▁
solid-start.minimal 46.2 KiB
-11 B
46.1 KiB
-12 B
135.1 KiB
-25 B
41.1 KiB
-106 B
▁██████████▇
solid-start.deferred-hydration 49.2 KiB
-10 B
46.1 KiB
-12 B
142.4 KiB
-25 B
43.9 KiB
-35 B
▁██████████▇
solid-start.full 51.2 KiB
-19 B
51.1 KiB
-16 B
150.1 KiB
-25 B
45.4 KiB
-20 B
▁██████████▆
vue-start.minimal 65.4 KiB
-14 B
65.3 KiB
-13 B
185.7 KiB
-50 B
58.3 KiB
-36 B
▁██████████▆
vue-start.full 69.2 KiB
-17 B
69.0 KiB
-16 B
197.5 KiB
-50 B
61.6 KiB
-101 B
▁██████████▆

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-new Bot commented Nov 30, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@9033

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@9033

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@9033

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@9033

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@9033

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@9033

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@9033

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@9033

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@9033

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@9033

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@9033

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@9033

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@9033

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@9033

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@9033

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@9033

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@9033

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@9033

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@9033

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@9033

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@9033

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@9033

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@9033

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@9033

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@9033

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@9033

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@9033

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@9033

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@9033

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@9033

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@9033

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@9033

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@9033

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@9033

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@9033

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@9033

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@9033

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@9033

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@9033

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@9033

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@9033

commit: dad27ea

@codspeed

codspeed Bot commented Nov 30, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.74%

Warning

TanStack has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 13, 2026 to keep using CodSpeed.

1 warning, 1 note

⚠️ 45 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 2 benchmarks have no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

❌ 2 regressed benchmarks
✅ 198 untouched benchmarks
⏩ 3 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory mem client navigation-churn (solid) 133 KB 154.6 KB -13.93%
❌ Memory mem client mount-unmount (solid) 108.9 KB 123.1 KB -11.53%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing chore/composite-projects (dad27ea) with test/published-declaration-check (fa61d01)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

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