export declare interface I18nConfig { translationsDir: string defaultLocale: string fallbackLocale?: string | string[] include?: string[] verbose?: boolean outDir?: string typesOutFile?: string sources?: SourceKind[] optional?: boolean } export declare interface TransParams { [key: string]: string | number } export declare interface TranslationTree { [key: string]: TranslationValue | TranslationTree } export declare interface LocaleData { locale: string messages: TranslationTree } export declare interface BuildResult { locales: string[] files: string[] outputDir: string } export type TranslationValue = string | number | boolean | null | ((_params?: TransParams) => string); export type Dictionary = TranslationTree; /** Utility to join two path segments with a dot (avoids leading dot) */ export type JoinPath = A extends '' ? B : `${A}.${B}`; /** Leaf values considered renderable for translations */ export type RenderableLeaf = string | number | boolean | null | undefined | ((_params?: TransParams) => string); /** * Produces a union of dot-separated keys for all leaf values of T. * Functions are considered leaves and included as keys. */ declare type PrevDepth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; declare type Dec = PrevDepth[D]; export type DotPaths = D extends 0 ? (P extends '' ? never : P) : T extends RenderableLeaf ? P : T extends Record ? { [K in keyof T & string]: T[K] extends RenderableLeaf ? JoinPath : DotPaths, Dec> }[keyof T & string] : never; /** Resolve the value at a dot-separated path K within T */ export type PathValue = D extends 0 ? never : K extends `${infer H}.${infer R}` ? H extends keyof T ? PathValue> : never : K extends keyof T ? T[K] : never; /** Extract the params object for a given key K (if the leaf is a function) */ export type ParamsForLeaf = V extends (..._args: infer A) => any ? (A extends [] ? undefined : A[0]) : never; export type ParamsForKey = ParamsForLeaf>; /** A typed translator for a given base tree shape T */ export type TranslatorFor = >(_key: K, _localeOrParams?: string | ParamsForKey, _maybeParams?: ParamsForKey) => string; export type SourceKind = 'ts' | 'yaml' | 'json';