Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

TypeScript · 13 lines · 439 B · at 74947de

export type RouteMatch = { route: string; params: Record<string, string> };export class RouteError extends Error {  readonly kind = "invalid_route" as const;  constructor(public readonly route: string) {    super(`invalid_route: ${route}`);  }}/** Returns undefined when nothing matches. Throws RouteError for an invalid pattern. */export function matchRoute(routes: string[], path: string): RouteMatch | undefined {  // TODO}