Add type-safe custom data for `notFound`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
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-coreNotFoundErrortype. - Type
notFound,routeApi.notFound, andNotFoundRouteProps.dataconsistently. - Cover React, Solid, and Vue bindings.
- Decide whether the type is global through
Registeror 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
notFoundreference documentation with the supported augmentation pattern. - Avoid runtime or bundle-size changes.
Related: #3112 and discussion #3113.
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
Read the shared router-core NotFoundError type first, then trace notFound, routeApi.notFound, and NotFoundRouteProps.data across the React, Solid, and Vue bindings. Review the related pull request and discussion for the global-versus-per-route decision. Add the requested type tests for returned and thrown errors, update the notFound reference documentation with the supported augmentation pattern, and verify unchanged behavior without custom configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100