-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(router-core): update ErrorRouteComponent to support generic error type #4727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(router-core): update ErrorRouteComponent to support generic error type #4727
Conversation
Signed-off-by: leesb971204 <[email protected]>
View your CI Pipeline Execution ↗ for commit 690778e
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-with-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
@@ -49,7 +49,7 @@ import type { LinkComponentRoute } from './link' | |||
declare module '@tanstack/router-core' { | |||
export interface UpdatableRouteOptionsExtensions { | |||
component?: RouteComponent | |||
errorComponent?: false | null | ErrorRouteComponent | |||
errorComponent?: false | null | ErrorRouteComponent<any> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we wouldn't add the TError
generic?
export interface UpdatableRouteOptionsExtensions<TError = Error> {
errorComponent?: false | null | ErrorRouteComponent<TError>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any additional ideas regarding this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure to be honest. Its unclear to me why that would cause a compiler error, and I explicitly use code-based routing (createRoute) not file based. I suspect you would have to chase the generic error type onto UpdatableRouteOptionsExtensions
as well, but now I'm starting to second guess following this through.
I would defer to @schiller-manuel.
fixes #4686
more of #4691
I added a generic to
ErrorComponentProps
to allow specifying the error type,but since the generic wasn’t passed through in the
ErrorRouteComponent
type, I added explicit typing there as well.