forked from i18next/next-i18next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
68 lines (61 loc) · 1.67 KB
/
types.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* tslint:disable no-explicit-any */
import * as React from 'react'
import {
useTranslation,
TransProps,
withTranslation,
WithTranslation
} from 'react-i18next'
import { LinkProps } from 'next/link'
import { SingletonRouter } from 'next/router'
import i18next from 'i18next'
export type InitConfig = {
browserLanguageDetection?: boolean;
serverLanguageDetection?: boolean;
strictMode?: boolean;
defaultLanguage: string;
ignoreRoutes?: string[];
localePath?: string;
localeStructure?: string;
otherLanguages: string[];
localeSubpaths?: Record<string, string>;
use?: any[];
customDetectors?: any[];
} & i18next.InitOptions
export type Config = {
fallbackLng: boolean;
allLanguages: string[];
whitelist: string[];
preload: string[];
} & InitConfig
export type Trans = (props: TransProps) => any
export type Link = React.ComponentClass<LinkProps>
export type Router = SingletonRouter
export type UseTranslation = typeof useTranslation
export type AppWithTranslation = <P extends object>(Component: React.ComponentType<P> | React.ElementType<P>) => any
export type TFunction = i18next.TFunction
export type I18n = i18next.i18n
export type WithTranslationHocType = typeof withTranslation
export type WithTranslation = WithTranslation
declare class NextI18Next {
constructor(config: InitConfig);
Trans: Trans
Link: Link
Router: Router
i18n: I18n
config: Config
useTranslation: UseTranslation
withTranslation: WithTranslationHocType
appWithTranslation: AppWithTranslation
}
declare global {
namespace Express {
interface Request {
i18n?: I18n & {
options: Config;
};
lng?: string;
}
}
}
export default NextI18Next