TanStack / TanStack/router

fix(router-core): model error component props as unknown

Open
#7,788 0 comments 1 reaction 0 assignees View on GitHub

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-Error values 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.