interface NumberSkeletonToken { stem: string; options: string[]; } //#region packages/ecma402-abstract/types/number.d.ts type NumberFormatNotation$1 = "standard" | "scientific" | "engineering" | "compact"; type RoundingPriorityType$1 = "auto" | "morePrecision" | "lessPrecision"; type RoundingModeType$1 = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven"; type UseGroupingType$1 = "min2" | "auto" | "always" | boolean; interface NumberFormatDigitOptions$1 { minimumIntegerDigits?: number; minimumSignificantDigits?: number; maximumSignificantDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; roundingPriority?: RoundingPriorityType$1; roundingIncrement?: number; roundingMode?: RoundingModeType$1; trailingZeroDisplay?: TrailingZeroDisplay$1; } type NumberFormatOptionsLocaleMatcher$1 = "lookup" | "best fit"; type NumberFormatOptionsStyle$1 = "decimal" | "percent" | "currency" | "unit"; type NumberFormatOptionsCompactDisplay$1 = "short" | "long"; type NumberFormatOptionsCurrencyDisplay$1 = "symbol" | "code" | "name" | "narrowSymbol"; type NumberFormatOptionsCurrencySign$1 = "standard" | "accounting"; type NumberFormatOptionsNotation$1 = NumberFormatNotation$1; type NumberFormatOptionsSignDisplay$1 = "auto" | "always" | "never" | "exceptZero" | "negative"; type NumberFormatOptionsUnitDisplay$1 = "long" | "short" | "narrow"; type TrailingZeroDisplay$1 = "auto" | "stripIfInteger"; type NumberFormatOptions$1 = Omit & NumberFormatDigitOptions$1 & { localeMatcher?: NumberFormatOptionsLocaleMatcher$1; style?: NumberFormatOptionsStyle$1; compactDisplay?: NumberFormatOptionsCompactDisplay$1; currencyDisplay?: NumberFormatOptionsCurrencyDisplay$1; currencySign?: NumberFormatOptionsCurrencySign$1; notation?: NumberFormatOptionsNotation$1; signDisplay?: NumberFormatOptionsSignDisplay$1; unit?: string; unitDisplay?: NumberFormatOptionsUnitDisplay$1; numberingSystem?: string; trailingZeroDisplay?: TrailingZeroDisplay$1; roundingPriority?: RoundingPriorityType$1; roundingIncrement?: number; roundingMode?: RoundingModeType$1; useGrouping?: UseGroupingType$1; }; //#endregion //#region packages/icu-messageformat-parser/types.d.ts interface ExtendedNumberFormatOptions extends NumberFormatOptions$1 { scale?: number; } declare enum TYPE { /** * Raw text */ literal = 0, /** * Variable w/o any format, e.g `var` in `this is a {var}` */ argument = 1, /** * Variable w/ number format */ number = 2, /** * Variable w/ date format */ date = 3, /** * Variable w/ time format */ time = 4, /** * Variable w/ select format */ select = 5, /** * Variable w/ plural format */ plural = 6, /** * Only possible within plural argument. * This is the `#` symbol that will be substituted with the count. */ pound = 7, /** * XML-like tag */ tag = 8 } declare enum SKELETON_TYPE { number = 0, dateTime = 1 } interface LocationDetails { offset: number; line: number; column: number; } interface Location { start: LocationDetails; end: LocationDetails; } interface BaseElement { type: T; value: string; location?: Location; } type LiteralElement = BaseElement; type ArgumentElement = BaseElement; interface TagElement extends BaseElement { children: MessageFormatElement[]; } interface SimpleFormatElement extends BaseElement { style?: string | S | null; } type NumberElement = SimpleFormatElement; type DateElement = SimpleFormatElement; type TimeElement = SimpleFormatElement; type ValidPluralRule = "zero" | "one" | "two" | "few" | "many" | "other" | string; interface PluralOrSelectOption { value: MessageFormatElement[]; location?: Location; } interface SelectElement extends BaseElement { options: Record; } interface PluralElement extends BaseElement { options: Record; offset: number; pluralType: Intl.PluralRulesOptions["type"]; } interface PoundElement { type: TYPE.pound; location?: Location; } type MessageFormatElement = ArgumentElement | DateElement | LiteralElement | NumberElement | PluralElement | PoundElement | SelectElement | TagElement | TimeElement; interface NumberSkeleton { type: SKELETON_TYPE.number; tokens: NumberSkeletonToken[]; location?: Location; parsedOptions: ExtendedNumberFormatOptions; } interface DateTimeSkeleton { type: SKELETON_TYPE.dateTime; pattern: string; location?: Location; parsedOptions: Intl.DateTimeFormatOptions; } type Skeleton = NumberSkeleton | DateTimeSkeleton; //#endregion //#region packages/icu-messageformat-parser/parser.d.ts interface ParserOptions { /** * Whether to treat HTML/XML tags as string literal * instead of parsing them as tag token. * When this is false we only allow simple tags without * any attributes */ ignoreTag?: boolean; /** * Should `select`, `selectordinal`, and `plural` arguments always include * the `other` case clause. */ requiresOtherClause?: boolean; /** * Whether to parse number/datetime skeleton * into Intl.NumberFormatOptions and Intl.DateTimeFormatOptions, respectively. */ shouldParseSkeletons?: boolean; /** * Capture location info in AST * Default is false */ captureLocation?: boolean; /** * Instance of Intl.Locale to resolve locale-dependent skeleton */ locale?: Intl.Locale; } //#endregion //#region packages/icu-messageformat-parser/index.d.ts declare function parse(message: string, opts?: ParserOptions): MessageFormatElement[]; //#region packages/ecma402-abstract/types/number.d.ts type NumberFormatNotation = "standard" | "scientific" | "engineering" | "compact"; type RoundingPriorityType = "auto" | "morePrecision" | "lessPrecision"; type RoundingModeType = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven"; type UseGroupingType = "min2" | "auto" | "always" | boolean; interface NumberFormatDigitOptions { minimumIntegerDigits?: number; minimumSignificantDigits?: number; maximumSignificantDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; roundingPriority?: RoundingPriorityType; roundingIncrement?: number; roundingMode?: RoundingModeType; trailingZeroDisplay?: TrailingZeroDisplay; } type NumberFormatOptionsLocaleMatcher = "lookup" | "best fit"; type NumberFormatOptionsStyle = "decimal" | "percent" | "currency" | "unit"; type NumberFormatOptionsCompactDisplay = "short" | "long"; type NumberFormatOptionsCurrencyDisplay = "symbol" | "code" | "name" | "narrowSymbol"; type NumberFormatOptionsCurrencySign = "standard" | "accounting"; type NumberFormatOptionsNotation = NumberFormatNotation; type NumberFormatOptionsSignDisplay = "auto" | "always" | "never" | "exceptZero" | "negative"; type NumberFormatOptionsUnitDisplay = "long" | "short" | "narrow"; type TrailingZeroDisplay = "auto" | "stripIfInteger"; type NumberFormatOptions = Omit & NumberFormatDigitOptions & { localeMatcher?: NumberFormatOptionsLocaleMatcher; style?: NumberFormatOptionsStyle; compactDisplay?: NumberFormatOptionsCompactDisplay; currencyDisplay?: NumberFormatOptionsCurrencyDisplay; currencySign?: NumberFormatOptionsCurrencySign; notation?: NumberFormatOptionsNotation; signDisplay?: NumberFormatOptionsSignDisplay; unit?: string; unitDisplay?: NumberFormatOptionsUnitDisplay; numberingSystem?: string; trailingZeroDisplay?: TrailingZeroDisplay; roundingPriority?: RoundingPriorityType; roundingIncrement?: number; roundingMode?: RoundingModeType; useGrouping?: UseGroupingType; }; //#endregion //#region packages/intl-messageformat/formatters.d.ts declare global { namespace FormatjsIntl { interface Message {} interface IntlConfig {} interface Formats {} } } type Format = Source extends keyof FormatjsIntl.Formats ? FormatjsIntl.Formats[Source] : string; interface Formats { number: Record, NumberFormatOptions>; date: Record, Intl.DateTimeFormatOptions>; time: Record, Intl.DateTimeFormatOptions>; } interface Formatters { getNumberFormat(locals?: string | string[], opts?: NumberFormatOptions): Intl.NumberFormat; getDateTimeFormat(...args: ConstructorParameters): Intl.DateTimeFormat; getPluralRules(...args: ConstructorParameters): Intl.PluralRules; } declare enum PART_TYPE { literal = 0, object = 1 } interface LiteralPart { type: PART_TYPE.literal; value: string; } interface ObjectPart { type: PART_TYPE.object; value: T; } type MessageFormatPart = LiteralPart | ObjectPart; type PrimitiveType = string | number | bigint | boolean | null | undefined | Date; type FormatXMLElementFn = (parts: Array) => R; //#endregion //#region packages/intl-messageformat/core.d.ts interface Options extends Omit { formatters?: Formatters; } declare class IntlMessageFormat { private readonly ast; private readonly locales; private readonly resolvedLocale?; private readonly formatters; private readonly formats; private readonly message; private readonly formatterCache; constructor(message: string | MessageFormatElement[], locales?: string | string[], overrideFormats?: Partial, opts?: Options); format: (values?: Record>) => string | T | (string | T)[]; formatToParts: (values?: Record>) => MessageFormatPart[]; resolvedOptions: () => { locale: string; }; getAst: () => MessageFormatElement[]; private static memoizedDefaultLocale; static get defaultLocale(): string; static resolveLocale: (locales: string | string[]) => Intl.Locale | undefined; static __parse: typeof parse | undefined; static formats: Formats; } export { IntlMessageFormat as default };