Documentation
Framework
Version

Register type

This type is used to register a route tree with a router instance. Doing so unlocks the full type safety of TanStack Router, including top-level exports from the @tanstack/react-router package.

export type Register = {
  // router: [Your router type here]
}
export type Register = {
  // router: [Your router type here]
}

To register a route tree with a router instance, use declaration merging to add the type of your router instance to the Register interface under the router property:

Examples

const router = createRouter({
  // ...
})

declare module '@tanstack/react-router' {
  interface Register {
    router: typeof router
  }
}
const router = createRouter({
  // ...
})

declare module '@tanstack/react-router' {
  interface Register {
    router: typeof router
  }
}
Our Partners
Code Rabbit
Cloudflare
Netlify
Neon
Clerk
Convex
Sentry
Strapi
Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.