to restrict values to specific strings. For example:
type Page = 'Home' | 'Login' | 'UserProfile';
export const routeConfig: RouteConfig<Page> = {
'/': 'Home',
'/login': 'Login',
'/user/:id': 'UserProfile'
};
export const router = createRouter({ routeConfig });
This will provide auto-suggest and type safety for route values.
router.toRoute('invalid') // error
router.toUrl('invalid') // error
Generated using TypeDoc
Route configuration. This is a plain object that associates route path templates to values. Route path templates may contain parameters by using
:
as a prefix. For example: