UNPKG

@bespunky/angular-zen

Version:

The Angular tools you always wished were there.

6 lines (5 loc) 520 B
import type { Split, TrimPrefix, FirstChar, Join } from '@bespunky/typescript-utils'; export declare type RouteSegments<Path extends string> = Split<Path, '/'>; export declare type RouteArgument<Path extends string> = Extract<RouteSegments<Path>[number], `:${string}`>; export declare type RouteArgumentName<Path extends string> = TrimPrefix<RouteArgument<Path>, ':'>; export declare type CombinedPath<Root extends string, Segment extends string> = FirstChar<Root> extends string ? Join<[Root, Segment], '/'> : Segment;