diff --git a/src/runtime/types/index.ts b/src/runtime/types/index.ts index 90dcdb4..ad0aace 100644 --- a/src/runtime/types/index.ts +++ b/src/runtime/types/index.ts @@ -14,25 +14,9 @@ export interface MessageObject { values?: Record } -export type MessageFormatter = ( - id: string | MessageObject, - options?: MessageObject -) => string - -export type TimeFormatter = ( - d: Date | number, - options?: IntlFormatterOptions -) => string - -export type DateFormatter = ( - d: Date | number, - options?: IntlFormatterOptions -) => string - -export type NumberFormatter = ( - d: number, - options?: IntlFormatterOptions -) => string +interface FormatterFn { + (id: string | MessageObject, options?: MessageObject): string +} type IntlFormatterOptions = T & { format?: string @@ -43,6 +27,25 @@ export interface MemoizedIntlFormatter { (options?: IntlFormatterOptions): T } +export interface Formatter extends FormatterFn { + time: ( + d: Date | number, + options?: IntlFormatterOptions + ) => string + date: ( + d: Date | number, + options?: IntlFormatterOptions + ) => string + number: ( + d: number, + options?: IntlFormatterOptions + ) => string + capital: FormatterFn + title: FormatterFn + upper: FormatterFn + lower: FormatterFn +} + export interface MessagesLoader { (): Promise }