diff --git a/src/runtime/types/index.ts b/src/runtime/types/index.ts index ad0aace..90dcdb4 100644 --- a/src/runtime/types/index.ts +++ b/src/runtime/types/index.ts @@ -14,9 +14,25 @@ export interface MessageObject { values?: Record } -interface FormatterFn { - (id: string | MessageObject, options?: MessageObject): string -} +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 type IntlFormatterOptions = T & { format?: string @@ -27,25 +43,6 @@ 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 }