Skip to content

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

Closed

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

Activity

  1. changed the title [-]router-core: ssr/types.d.ts references stripped @internal field, breaking tsc for skipLibCheck: false consumers[/-] [+]router-core: ssr/types.d.ts references stripped @internal field, breaks tsc for consumers typechecking libs[/+] on Aug 31, 2026
  2. Sheraff commented on Aug 31, 2026

    @Sheraff
    Collaborator

    Out of curiosity, why do you typecheck your dependencies?

  3. oddsund commented on Sep 1, 2026

    @oddsund
    Author

    Mostly for completeness and correctness, I guess.
    Someone who has thought more about this than me(the people creating Typescript) has set the skipLibCheck to false as a default, so I haven given it that much thought to be honest. 😅

    Oh, and I probably should have mentioned this; I created the PR #8206 to fix it by inlining the type of RouteMatch['__beforeLoadContext']. Didn't think about the @internal annotation as a fix, but I thought about removing the field(which would be the same as @internal for external consumers?). I eventually decided against it to avoid breaking it for any consumers who is using it. But maybe this is internal stuff that consumers shouldn't be poking around anyways?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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