You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Regression (7.0.0-dev.20260624.1): intersection type member dropped in generic position — TanStack Router stripSearchParams rejected (TS2322), clean in tsc + 20260623.1 #4462
Starting with @typescript/[email protected], tsgo reports a spurious TS2322 on valid TanStack Router code.
A route's resolved search schema is the intersection of its parent's search schema and the route's own validateSearch output. When that schema is used as a type argument (here, for the stripSearchParams search middleware), tsgo drops the route's own member from the intersection, leaving only the parent's. The middleware — correctly typed SearchMiddleware<Parent & Own> — is then checked against SearchMiddleware<Parent> and rejected.
The identical code compiles cleanly with stable tsc (6.0.3) and with tsgo 7.0.0-dev.20260623.1. It bisects to 20260624.1.
This is likely the same underlying regression as #4391 (also TanStack router-core, same build window) — there a const type parameter loses a string-literal property through Omit<...>, surfacing as TS2353. This report is a smaller, different surface (an intersection member dropped in a generic position, surfacing as TS2322).
No error. The route's search schema is { page: number } & { billing: 'monthly' | 'yearly' }, and stripSearchParams({ billing: 'monthly' }) yields a SearchMiddleware for exactly that type. (Stable tsc and tsgo 20260623.1 both accept it.)
Actual (tsgo >= 20260624.1)
src/routes/pricing.tsx(10,27): error TS2322: Type 'SearchMiddleware<{ billing: "monthly" | "yearly"; } & { page: number; }>' is not assignable to type 'SearchMiddleware<{ page: number; }>'.
The expected type has collapsed to the parent-only { page: number } — the route's own { billing } member is dropped from the intersection in this generic position.
Real-world impact
In a full app (root validateSearch + many file routes), this same root cause cascades widely: TS2322 on every stripSearchParams middleware, plus TS2339 on Route.useSearch().<ownField> and TS2353 on navigate({ search }) object literals, because the per-route resolved search schema everywhere falls back to the root-only schema. A single mid-size app surfaced ~156 such errors on 20260627.2, all clean on 20260623.1.
Activity
meabed commentedon Jun 27, 2026
Runnable reproduction repo: https://github.com/meabed/tsgo-tanstack-router-search-repro
(
src/routeTree.gen.tsis committed, so no generate step needed; re-runnpx tsr generateif you change the routes.)jakebailey commentedon Jun 28, 2026
Bisects to #4389 Anders Hejlsberg (@ahejlsberg)