ref(ts): Remove unused RouteContextInterface type#115996
Merged
evanpurkhiser merged 1 commit intoMay 21, 2026
Merged
Conversation
RouteContextInterface had two consumers: an inline Pick in the react-hook:route-activated override prop type, and a declare context on DeprecatedAsyncComponent that nothing actually read. Inline the Pick as a small literal type and drop the dead class context declaration, then delete the interface.
Contributor
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.61% |
ryan953
approved these changes
May 21, 2026
JonasBa
pushed a commit
that referenced
this pull request
May 21, 2026
`RouteContextInterface` was a legacy react-router 3 type that ended up
with only two consumers, both of which were trivially removable:
- `overrides.tsx` used `Pick<RouteContextInterface, 'location' |
'matches'>` to type the `react-hook:route-activated` override prop.
Replaced with an inline literal `{location: Location; matches:
UIMatch[]}` — same shape, no indirection through a legacy interface.
- `DeprecatedAsyncComponent` had a `declare context: {router:
RouteContextInterface}` field. Nothing in the codebase reads
`this.context.router` on any subclass — it was a leftover type
annotation for a class context that's never wired up.
With those gone the interface itself has no consumers, so it's deleted
from `legacyReactRouter.tsx`.
Small step toward eventually killing the rest of the legacy router types
(`PlainRoute`, `InjectedRouter`, `RouteComponentProps`), but each of
those still has real consumers and is its own track.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RouteContextInterfacewas a legacy react-router 3 type that ended up with only two consumers, both of which were trivially removable:overrides.tsxusedPick<RouteContextInterface, 'location' | 'matches'>to type thereact-hook:route-activatedoverride prop. Replaced with an inline literal{location: Location; matches: UIMatch[]}— same shape, no indirection through a legacy interface.DeprecatedAsyncComponenthad adeclare context: {router: RouteContextInterface}field. Nothing in the codebase readsthis.context.routeron any subclass — it was a leftover type annotation for a class context that's never wired up.With those gone the interface itself has no consumers, so it's deleted from
legacyReactRouter.tsx.Small step toward eventually killing the rest of the legacy router types (
PlainRoute,InjectedRouter,RouteComponentProps), but each of those still has real consumers and is its own track.