Type alias RouteParameters<Route>

RouteParameters<Route>: string extends Route
    ? ParamsDictionary
    : Route extends `${string}(${string}`
        ? ParamsDictionary
        : Route extends `${string}:${infer Rest}`
            ? (GetRouteParameter<Rest> extends never
                ? ParamsDictionary
                : GetRouteParameter<Rest> extends `${infer ParamName}?`
                    ? {
                        [P in ParamName]?: string
                    }
                    : {
                        [P in GetRouteParameter<Rest>]: string
                    }) & (Rest extends `${GetRouteParameter<Rest>}${infer Next}`
                ? RouteParameters<Next>
                : unknown)
            : {}

Type Parameters

  • Route extends string