Skip to content

isRoute

ts
export function isRoute(route: unknown): route is RouterRoute
function isRoute<TRouteKey>(route: RouterRoute, routeKey: TRouteKey, options?: isRouteOptions): route is RouterRoute<ResolvedRoute<RegisteredRouteMap[TRouteKey]>>

Type guards that asserts a value is RouterRoute and optionally that it is also a specific route based on a route key.

Type parameters

Type parameterDescription
TRouteKey extends stringA string type that should match route key of RegisteredRouteMap, ensuring the route key exists.

Parameters

ParameterTypeDescription
routeRouterRouteThe current route
routeKeyTRouteKeyOptional. The key of the route to validate against.
options.exactbooleanOptional. If true a parent of the current route will not be considered a match