From 88f7762e96c4eae963722bdedf601afbce4b2f17 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Thu, 23 Jan 2020 10:39:54 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20types=20from=20v3=20branc?= =?UTF-8?q?h=20leaking=20to=20master=20branch=20:shrug:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/runtime/types/index.ts | 41 ++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-) 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 }