TanStack / TanStack/router

Add type-safe custom data for `notFound`

Open
#7,774 0 comments 0 reactions 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

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.

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.