import type { Component } from "ripple"; // Utility types for extracting path parameters from route strings export type ExtractPathParams = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param]: string } & ExtractPathParams<`/${Rest}`> : T extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : {}; // Type-safe route props based on path export type TypedRouteProps = { params: ExtractPathParams; searchParams?: Record; }; // Helper type for creating type-safe route components export type TypedRouteComponent = Component>; // Type-safe route definition export type TypedRoute = { path: T; component: TypedRouteComponent; };