notFound({ data }) currently accepts any, while notFoundComponent receives data as unknown. This forces consumers to add their own type guards or casts.
Add a shared type-safe way to configure custom not-found data. The solution should:
- Work through the shared
router-core NotFoundError type.
- Type
notFound, routeApi.notFound, and NotFoundRouteProps.data consistently.
- Cover React, Solid, and Vue bindings.
- Decide whether the type is global through
Register or configurable per route.
- Preserve existing behavior for applications that do not configure a custom type.
- Add type tests for returned and thrown not-found errors.
- Update the
notFound reference documentation with the supported augmentation pattern.
- Avoid runtime or bundle-size changes.
Related: #3112 and discussion #3113.
notFound({ data })currently acceptsany, whilenotFoundComponentreceivesdataasunknown. This forces consumers to add their own type guards or casts.Add a shared type-safe way to configure custom not-found data. The solution should:
router-coreNotFoundErrortype.notFound,routeApi.notFound, andNotFoundRouteProps.dataconsistently.Registeror configurable per route.notFoundreference documentation with the supported augmentation pattern.Related: #3112 and discussion #3113.