Skip to content

Commit

Permalink
⚡ improvement(flowtype): Fix missing type declarations in flow type (#…
Browse files Browse the repository at this point in the history
…529) by @exoego

* Conform flow type declarations to TypeScript type definitions.

* Use explicit type instead of anonymous type.
  • Loading branch information
exoego authored and kazupon committed Mar 8, 2019
1 parent 8f75b1f commit 4173764
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions decls/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ declare type I18nOptions = {
sync?: boolean,
silentTranslationWarn?: boolean,
silentFallbackWarn?: boolean,
pluralizationRules?: {
[lang: string]: (choice: number, choicesLength: number) => number,
},
pluralizationRules?: PluralizationRules,
preserveDirectiveContent?: boolean,
};

Expand All @@ -74,6 +72,10 @@ declare type IntlAvailability = {
numberFormat: boolean
};

declare type PluralizationRules = {
[lang: string]: (choice: number, choicesLength: number) => number,
}

declare interface I18n {
static install: () => void, // for Vue plugin interface
static version: string,
Expand All @@ -85,6 +87,7 @@ declare interface I18n {
set fallbackLocale (locale: Locale): void,
get messages (): LocaleMessages,
get dateTimeFormats (): DateTimeFormats,
get numberFormats (): NumberFormats,
get availableLocales (): Locale[],
get missing (): ?MissingHandler,
set missing (handler: MissingHandler): void,
Expand All @@ -94,6 +97,11 @@ declare interface I18n {
set silentTranslationWarn (silent: boolean): void,
get silentFallbackWarn (): boolean,
set silentFallbackWarn (slient: boolean): void,
get pluralizationRules (): PluralizationRules,
set pluralizationRules (rules: PluralizationRules): void,
get preserveDirectiveContent (): boolean,
set preserveDirectiveContent (preserve: boolean): void,

getLocaleMessage (locale: Locale): LocaleMessageObject,
setLocaleMessage (locale: Locale, message: LocaleMessageObject): void,
mergeLocaleMessage (locale: Locale, message: LocaleMessageObject): void,
Expand All @@ -109,9 +117,8 @@ declare interface I18n {
setNumberFormat (locale: Locale, format: NumberFormat): void,
mergeNumberFormat (locale: Locale, format: NumberFormat): void,
n (value: number, ...args: any): NumberFormatResult,
pluralizationRules: {
[lang: string]: (choice: number, choicesLength: number) => number
},
getChoiceIndex: (choice: number, choicesLength: number) => number,
pluralizationRules: PluralizationRules,
preserveDirectiveContent: boolean
};

Expand Down

0 comments on commit 4173764

Please sign in to comment.