messageformat
Version:
Intl.MessageFormat / Unicode MessageFormat 2 parser, runtime and polyfill
27 lines (26 loc) • 1.01 kB
TypeScript
import type { MessageExpressionPart } from '../formatted-parts.ts';
import type { MessageValue } from '../message-value.ts';
import type { MessageFunctionContext } from '../resolve/function-context.ts';
/**
* The resolved value of a {@link DefaultFunctions.string | :string} expression,
* or of an expression with a literal operand and no function.
*/
export interface MessageString extends MessageValue<'string'> {
readonly type: 'string';
readonly dir: 'ltr' | 'rtl' | 'auto';
selectKey(keys: Set<string>): string | null;
toParts(): [MessageStringPart];
toString(): string;
valueOf(): string;
}
/**
* The formatted part for a {@link MessageString} value.
*
* @category Formatted Parts
*/
export interface MessageStringPart extends MessageExpressionPart<'string'> {
type: 'string';
locale: string;
value: string;
}
export declare function string(ctx: Pick<MessageFunctionContext, 'dir' | 'locales'>, _options: Record<string, unknown>, operand?: unknown): MessageString;