/** * Dynamic i18n Message Resolver Pattern * * Enables dynamic message function calls for config selectors. * Creates a resolver that dynamically looks up and calls message functions. */ type MessageBundle = Record string>; interface MessageResolverConfig { /** * Function to extract the message key from an option * @example (currency) => currency.code // "USD" */ keyExtractor: (option: T) => string; /** * Optional transformer for the key before message lookup * @example (key) => key.toLowerCase() // "USD" -> "usd" */ keyTransformer?: (key: string) => string; } /** * Creates a message resolver function for dynamic i18n lookups * * @example * ```typescript * const getCurrencyLabel = createMessageResolver(m, { * keyExtractor: (currency) => currency.code * }); * * getCurrencyLabel({ code: "EUR", symbol: "€" }); // "Euro" * ``` */ export declare function createMessageResolver( messages: MessageBundle, config: MessageResolverConfig, ): (option: T) => string; /** * Type guard to check if a message key exists */ export declare function hasMessage( messages: MessageBundle, key: string, ): boolean; /** * Batch resolver for multiple options at once */ export declare function batchResolveMessages( messages: MessageBundle, options: T[], config: MessageResolverConfig, ): Record; export {};