-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathindex.d.ts
44 lines (39 loc) · 1.18 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
declare module "i18next-icu" {
import { i18n, ThirdPartyModule } from "i18next";
/**
* @see https://github.com/yahoo/intl-messageformat#user-defined-formats
* @see https://github.com/i18next/i18next-icu/issues/12#issuecomment-578893063
*/
// prettier-ignore
export interface IcuFormats {
number?: {
[styleName: string]: Intl.NumberFormatOptions;
},
date?: {
[styleName: string]: Intl.DateTimeFormatOptions;
},
time?: {
[styleName: string]: Intl.DateTimeFormatOptions;
}
}
export interface IcuConfig {
memoize?: boolean;
memoizeFallback?: boolean;
formats?: IcuFormats;
bindI18n?: string;
bindI18nStore?: string;
parseErrorHandler?: (err: Error, key: string, res: string, options: Object) => string;
parseLngForICU?: (lng: string) => string;
}
export interface IcuInstance<TOptions = IcuConfig> extends ThirdPartyModule {
init(i18next: i18n, options?: TOptions): void;
addUserDefinedFormats(formats: IcuFormats): void;
clearCache(): void;
}
interface IcuConstructor {
new(config?: IcuConfig): IcuInstance;
type: "i18nFormat";
}
const ICU: IcuConstructor;
export default ICU;
}