next-translate-routes-multi-domain
Version:
Flexible and translated routes for Next.js without custom server
57 lines (56 loc) • 1.86 kB
TypeScript
/// <reference types="node" />
import type { Redirect, Rewrite } from 'next/dist/lib/load-custom-routes';
import type { I18NConfig, NextConfig, NextConfigComplete } from 'next/dist/server/config-shared';
import type { UrlObject } from 'url';
export declare type Url = UrlObject | string;
declare type TAnyLocale = Exclude<string, 'default'>;
export declare type TReRoutes = {
redirects: Redirect[];
rewrites: Rewrite[];
};
export declare type TRouteSegmentPaths<L extends TAnyLocale> = {
default: string;
} & Partial<Record<L, string>>;
export declare type TRouteSegmentData<L extends TAnyLocale> = string | ({
default?: string;
} & Partial<Record<L, string>>);
export declare type TRouteSegmentsData<L extends TAnyLocale> = Record<string, TRouteSegmentData<L>>;
export declare type TRouteSegment<L extends TAnyLocale> = {
name: string;
paths: TRouteSegmentPaths<L>;
};
export declare type TRouteBranch<L extends TAnyLocale = string> = TRouteSegment<L> & {
children?: TRouteBranch<L>[];
};
export declare type TNtrData = {
debug?: boolean | 'withPrefetch';
defaultLocale: string;
locales: string[];
routesTree: TRouteBranch;
};
export declare type NTRConfig = {
debug?: boolean;
routesDataFileName?: string;
routesTree?: TRouteBranch;
pagesDirectory?: string;
};
export declare type NextConfigWithNTR = NextConfig & {
i18n: I18NConfig;
translateRoutes?: NTRConfig;
};
export declare type NextConfigCompleteWithNTR = NextConfigComplete & {
i18n: I18NConfig;
translateRoutes: NTRConfig;
};
declare global {
var __NEXT_TRANSLATE_ROUTES_DATA: TNtrData;
interface Window {
__NEXT_TRANSLATE_ROUTES_DATA: TNtrData;
}
interface ErrorConstructor {
new (message?: string, options?: {
cause: unknown | string | Error;
}): Error;
}
}
export {};