Skip to content

router-core: ssr/types.d.ts references stripped @internal field, breaks tsc for consumers typechecking libs #8203

Description

@oddsund

Which project does this relate to?

Router

Describe the bug

packages/router-core/src/ssr/types.ts declares:

export interface DehydratedMatch {
  i: MakeRouteMatch['id']
  b?: MakeRouteMatch['__beforeLoadContext']
  ...
}

RouteMatch['__beforeLoadContext'] is tagged @internal. Since #4907 ("refactor(router-core): strip internal types from public build", 2025-08-10) enabled stripInternal repo-wide, that field has been removed from the published .d.ts — but this indexed-access reference to it was never updated, so it's been a dangling reference in every published .d.ts since router-core@1.171.16 (2026-08-04). #6118 later moved the interface to its current file unchanged, carrying the bug forward.

It went unnoticed by plain SPA consumers because nothing in the always-imported client path pulled ssr/types.ts into their type graph — until #7805's load-client.ts rewrite (also 2026-08-04) started importing TsrSsrGlobal from ./ssr/types.

Complete minimal reproducer

https://stackblitz.com/edit/tanstack-tsc-bug-rlvy22xm

Steps to Reproduce the Bug

npm install && npx tsc in the example repo

Observe that tsc fails on router-core's own shipped types:

node_modules/@tanstack/router-core/dist/esm/ssr/types.d.ts(5,24):
error TS2339: Property '__beforeLoadContext' does not exist on type 'MakeRouteMatch'.

Expected behavior

tsc passes against a stock createRouter/createRootRoute setup with default compiler options.

Screenshots or Videos

No response

Platform

  • @tanstack/react-router: 1.170.32 (latest as of writing; bug present since 1.170.19 / router-core 1.171.16, 2026-08-04)
  • @tanstack/router-core: 1.171.27 (latest as of writing; broken since 1.171.16)
  • TypeScript: 7.0.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions