Skip to content
On this page


name: string;

The name field is a constant value used for narrowing the type of a specific Route. This value will be false if a match to any of the routes you provided was unable to be made. As shown in the example this allows you to determine which route you're dealing with.


const { routes, session } = createRouter({
  home: defineRoute("/"),
  post: defineRoute({ postId: param.path.string }, (p) => `/post/${p.postId}`),

const route = session.getInitialRoute();

if ( === "post") {
  // Here both you and the editor will know that we're on
  // the "post" route and that route.params has a property
  // called "postId" of type string.

Type Route is a Zilch project