-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Which project does this relate to?
Router
Describe the bug
The ErrorComponentProps
type, that replaces the deprecated ErrorRouteProps
, incorrectly models the error
as an Error
.
In our production app, our fetch behaviour does not throw an Error
, but instead a detailed rich object that consumers can dig into.
In the simplest example, a route's loader
could throw a primitive data type such as a string
instead of an Error
, however the props of the associated errorComponent
(modelled as ErrorComponentProps
) presume that the error
will always be an Error
.
Your Example Website or App
https://stackblitz.com/edit/github-gk2uhnxn?file=src%2Froutes%2Findex.tsx
Steps to Reproduce the Bug or Issue
Throw a non-Error
data type in a loader
, for example throw 'hello'
.
Observe that the props of the loader's errorComponent
incorrectly model the error
prop as an Error
type, even though we called throw
with a typeof string
.
Expected behavior
Preferably:
- export type ErrorComponentProps = {
- error: Error
+ export type ErrorComponentProps<E> = {
+ error: E
info?: { componentStack: string }
reset: () => void
}
or at least:
- export type ErrorComponentProps = {
- error: Error
+ export type ErrorComponentProps = {
+ error: unknown
info?: { componentStack: string }
reset: () => void
}
Screenshots or Videos

Platform
@tanstack/[email protected]