Skip to content

ref(ts): Remove unused RouteContextInterface type#115996

Merged
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/ref-ts-remove-unused-routecontextinterface-type
May 21, 2026
Merged

ref(ts): Remove unused RouteContextInterface type#115996
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/ref-ts-remove-unused-routecontextinterface-type

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

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.

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.
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 21, 2026
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) May 21, 2026 13:24
@github-actions
Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.61%

@evanpurkhiser evanpurkhiser merged commit 18fdc03 into master May 21, 2026
72 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/ref-ts-remove-unused-routecontextinterface-type branch May 21, 2026 13:35
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants