Uh oh!
There was an error while loading. Please reload this page.
fix(router-core): fix dangling reference to stripped field - #8206
Conversation
`DehydratedMatch['b']` is typed by `RouteMatch['__beforeLoadContext']`, and `RouteMatch['__beforeLoadContext']` is tagged `@internal`. This worked fine until `stripInternal` was enabled in fd341ad(PR TanStack#4907), which strips `@internal` members from the published `.d.ts`. This has made this reference dangling since `router-core@1.171.16`. f330532 (PR TanStack#6118) later moved the interface to its current file unchanged. When 45c4ad8 (PR TanStack#7805) rewrote to `load-client.ts` and started importing from `./ssr/types`, the dangling reference was surfaced for consumers with `skipLibCheck: false` in this error: error TS2339: Property '__beforeLoadContext' does not exist on type 'MakeRouteMatch'. We solve this by giving `b` the declared type of `__beforeLoadContext`, instead of indexing into the stripped member. Verified against a built package: the emitted `dist/esm/ssr/types.d.ts` no longer references the internal member, and a minimal consumer repro type-checks cleanly with this dist swapped in.
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe PR changes ChangesDehydrated match context typing
Estimated code review effort: 2 (Simple) | ~5 minutes Merge Risk:⚪ Minimal · up to This patch fixes the published SSR type declaration without changing runtime behavior or serialized data. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🎯 Changes
DehydratedMatch['b']is typed byRouteMatch['__beforeLoadContext'], andRouteMatch['__beforeLoadContext']is tagged@internal. This worked fine untilstripInternalwas enabled in fd341ad(PR #4907), which strips@internalmembers from the published.d.ts. This has made this reference dangling sincerouter-core@1.171.16. f330532 (PR #6118) later moved the interface to its current file unchanged. When 45c4ad8 (PR #7805) rewrote toload-client.tsand started importing from./ssr/types, the dangling reference was surfaced for consumers withskipLibCheck: falsein this error:error TS2339: Property '__beforeLoadContext' does not exist on type 'MakeRouteMatch'.
We solve this by giving
bthe declared type of__beforeLoadContext, instead of indexing into the stripped member.Verified against a built package: the emitted
dist/esm/ssr/types.d.tsno longer references the internal member, and a minimal consumer repro type-checks cleanly with this dist swapped in.Fixes#8203
✅ Checklist
🚀 Release Impact
Summary by CodeRabbit