diff --git a/.changeset/dehydrated-match-before-load-context-type.md b/.changeset/dehydrated-match-before-load-context-type.md new file mode 100644 index 00000000000..f3bd7bc5913 --- /dev/null +++ b/.changeset/dehydrated-match-before-load-context-type.md @@ -0,0 +1,5 @@ +--- +'@tanstack/router-core': patch +--- + +Fix `DehydratedMatch['b']`, which was typed by `RouteMatch['__beforeLoadContext']` — a field tagged `@internal`. This worked fine until `stripInternal` was enabled in fd341ad (PR #4907), which strips `@internal` members from the published `.d.ts` and left this reference dangling since `router-core@1.171.16`. Consumers with `skipLibCheck: false` (the TS default) hit a `tsc` error on `@tanstack/router-core`'s own shipped types. Fixed by giving `b` the declared type of `__beforeLoadContext` instead of indexing into the stripped member. diff --git a/packages/router-core/src/ssr/types.ts b/packages/router-core/src/ssr/types.ts index 27bf1118430..b24c7800aec 100644 --- a/packages/router-core/src/ssr/types.ts +++ b/packages/router-core/src/ssr/types.ts @@ -3,7 +3,7 @@ import type { MakeRouteMatch } from '../Matches' export interface DehydratedMatch { i: MakeRouteMatch['id'] - b?: MakeRouteMatch['__beforeLoadContext'] + b?: Record l?: MakeRouteMatch['loaderData'] e?: MakeRouteMatch['error'] u: MakeRouteMatch['updatedAt']