import { Result } from '@fgv/ts-utils'; /** * Destination format for some formatted string. * @beta */ export type FormatTargets = 'text' | 'markdown' | 'embed'; /** * Interface for an object that can be formatted. * @beta */ export interface Formattable { /** * Formats an object using the supplied mustache template. * @param format - A mustache template used to format the object. * @returns `Success` with the resulting string, or `Failure` * with an error message if an error occurs. */ format(format: string): Result; } /** * Base class which adds common formatting. * @beta */ export declare class FormattableBase { /** * Helper enables derived classes to add named details to a formatted presentation. * @param details - An array of detail description strings. * @param label - Label to use for the new detail. * @param value - Value to use for the new detail. * @internal */ protected static _tryAddDetail(details: string[], label: string, value: string | undefined): void; /** * {@inheritdoc Experimental.Formattable.format} */ format(template: string): Result; } /** * Type definition for a formatting function, which takes a `string` and an * item and returns `Result`. * @beta */ export type Formatter = (format: string, item: T) => Result; /** * A collection of {@link Experimental.Formatter | formatters} indexed by target name, to enable * different format methods per output target. * @beta */ export type FormattersByExtendedTarget = Record>; /** * A collection of {@link Experimental.Formatter | formatters} indexed by the * {@link Experimental.FormatTargets | default supported target formats}. * @beta */ export type FormattersByTarget = FormattersByExtendedTarget; /** * Formats a list of items using the supplied template and formatter, one result * per output line. * @param format - A mustache template used to format each item. * @param items - The items to be formatted. * @param itemFormatter - The {@link Experimental.Formatter | Formatter} used to format each item. * @returns The resulting string. * @beta */ export declare function formatList(format: string, items: T[], itemFormatter: Formatter): Result; //# sourceMappingURL=formatter.d.ts.map