UNPKG

@eyedea/next-roots

Version:

Utility to handle internationalized routing for Next.js app folder.

32 lines (29 loc) 935 B
// Generated by dts-bundle-generator v8.1.2 export type Route = { name: `/${string}`; href: `/${string}`; }; export type RouterSchema = { routes: Record<string, Route[]>; locales: string[]; defaultLocale: string; }; declare class StaticRouter { private static PAGE_HREF; static getPageHref(): string; static setPageHref(pageHref: string): void; } export declare class Router extends StaticRouter { private schema; constructor(schema: RouterSchema); getHref(name: string, params?: Record<string, string>): string; getLocaleFromHref(href: string): string; getRouteFromHref(href: string): Route | undefined; private getLocalizedRoutes; private findRouteByLocaleAndName; private findRouteByLocaleAndHref; } export declare function compileHref(href: string, params: Record<string, string>): string; export declare function formatHref(...hrefSegments: string[]): string; export declare let schema: RouterSchema; export {};