[]previous and next page

Typed routes and links

The generated tree ends with an augmentation of the router's Register interface that lists the path of every page of your project (layouts are not links).

For agentsUpdated

The generated tree ends with an augmentation of the router's Register interface that lists the path of every page of your project (layouts are not links). After it, A to, navigate, useParams({ from }) and the other hooks accept only those paths.

Run that block and it prints the augmentation for this project. A link to a path that is not in the list is a type error:

text
error TS2322: Type '"/postz"' is not assignable to type '"/" | `/posts/${string}` | undefined'.

That message is from a project whose pages are / and /posts/:id.

The tree file also exports routeTree (what createHandler and hydrateDusk take), routes (every route by id, typed by path, with useParams(), useSearch() and useLoaderData() helpers), routeMeta (kind, file, ssr and prerender per route) and preloadRoutes(ids). Keep routeTree.gen.ts in version control or list it in .gitignore: either works, because the plugin regenerates it on dusk dev and dusk build. If your own code imports it (a custom src/entry-client.ts), or you rely on the typed links, run one of them before tsc.