-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
33 lines (24 loc) · 821 Bytes
/
types.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
export type TranslationValues = {
[key: string | number]: string | TranslationValues;
} | Array<string | TranslationValues>;
export type TranslationPromise = PromiseLike<TranslationValues>;
export type TranslationLoader = () => TranslationPromise;
export type TranslationFunction = (path: string, values?: TranslationValues | undefined) => string;
export type TranslationChange = Readonly<{
all: string[];
lang: string;
change: (next: string) => void;
preload: (next: string) => void;
}>;
export type TranslationProps = {
path: string;
values?: TranslationValues | undefined;
};
export type TranslationProviderProps = {
language?: string;
preloadLanguage?: boolean;
fallback?: string;
preloadFallback?: boolean;
translations: Record<string, TranslationLoader>;
transition?: boolean;
};