Repository navigation
chore: type-check packages against composite-project declarations - #9033
schiller-manuel wants to merge 4 commits into
Conversation
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>
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
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. |
|
View your CI Pipeline Execution ↗ for commit dad27ea
💡 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 |
🚀 Changeset Version Preview11 package(s) bumped directly, 17 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
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. |
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
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
🎯 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 Nxcompiletarget). Nothing published changes: all 2,803 files underpackages/*/distare byte-identical.Why: the next pull requests tag undocumented internals
@internal. Those leavedist, which users install, and stay visible to sibling packages through this set. Type checks also stop depending on Vite builds of dependencies.tsconfig.internal.json, a composite project that writes declarations withstripInternal: falsetodist-ts, and acompilescript (tsc6).packages/tsconfig.paths.jsonmaps every@tanstack/*entry point (117) todist-ts. It is types only: the targets have no extension, so runtime resolvers that read tsconfigpaths(Vite, jiti) find no JavaScript there and fall back todist.packages/tsconfig.base.jsonextends 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 todist, like a user.scripts/internal-types-config.mjsgenerates the map, the internal configs and thereferences, and checks that a package's imports of its own specifiers resolve to its source. Its test runs in the roottest:unitand fails when generated files are stale.compiletarget ordered by^compile. Forpackages/*,test:typesandtest:eslintdepend on^compileinstead of builds;buildandtest:unitadd^compile.src/default-entryself-imports to source. A deadpathsentry in solid-router-devtools is replaced by the map.dist-tsis ignored by git, Prettier and ESLint and removed byclean. AGENTS.md describescompileand how to regenerate the map.Measured: all 41 packages compile from clean in 14.6 s. With no
distanywhere,test:typesfor react-router needs only thecompileof history and router-core (4.1 s).Validated locally for
packages/*without the Nx cache:buildandcompile(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 redtest:buildof #9032 until TanStack/config#443 is released.Written with AI assistance (Claude Code).
✅ Checklist
🚀 Release Impact
🤖 Generated with Claude Code