fix(router-core): model error component props as unknown
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Problem
errorComponent receives the raw value thrown by route loading and rendering code. That value can be an Error, a primitive, or an arbitrary object.
ErrorComponentProps<TError> does not currently propagate TError through the framework ErrorRouteComponent types, so route error components cannot safely use a narrower error type.
Expected behavior
The public error prop should be typed as unknown. Error components should narrow the value before accessing error-specific properties.
A future typed-error API can be considered only if an explicit error type can propagate through route configuration and the React, Solid, and Vue error-component contracts.
Scope
- Change the baseline error-component prop type to
unknown. - Update React, Solid, and Vue error-component contracts.
- Add type tests that require narrowing before accessing error-specific properties.
- Preserve runtime coverage for non-
Errorvalues in client and SSR error boundaries. - Update the error-component API documentation.
Related Work
- #4686 introduced the original report.
- #4691 introduced the generic type that does not propagate through framework route components.
- #4727 attempts to resolve the mismatch by narrowing the prop to
Error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the React, Solid, and Vue ErrorRouteComponent contracts, then inspect the existing client and SSR error-boundary tests. Update the type tests so error-specific properties require narrowing, preserve coverage for non-Error values, and revise the error-component API documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- documentation, frontend, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100