import type { EndRoutePath, LocaleType, RoutePathInterface, SegmentRoutePath, } from "./types"; export interface Route< T extends RoutePathInterface, Locales extends LocaleType, // eslint-disable-next-line @typescript-eslint/no-unused-vars -- helps typescript to infer the type RouteRef, > { isSegment: () => boolean; isLocalized: () => boolean; getPath: (locale?: Locales) => T; toJSON: () => any; toString: () => string; } export interface EndRoute extends Route< EndRoutePath, Locales, RouteRef > { ref: RouteRef; isSegment: () => false; } export interface SegmentRoute< Locales extends LocaleType, RouteRef, > extends Route { defaultRoute: EndRoute | undefined; nestedRoutes: Route[]; isSegment: () => true; } export interface NotLocalizedRoute< T extends RoutePathInterface, Locales extends LocaleType, RouteRef, > extends Route { isLocalized: () => false; getPath: () => T; } export interface LocalizedRoute< T extends RoutePathInterface, Locales extends LocaleType, RouteRef, > extends Route { isLocalized: () => true; getPath: (locale?: Locales) => T; }