import { i18n as I18nNext, InitOptions as I18nNextInitOptions, TFunction as I18nNextTFunction } from 'i18next'; import { LinkProps } from 'next/link'; import { SingletonRouter } from 'next/router'; import React from 'react'; import { TransProps, useTranslation, WithTranslation as ReactI18nextWithTranslation, withTranslation } from 'react-i18next'; // declare module 'i18next' { // interface InitOptions { // allLanguages?: string[]; // defaultLanguage?: string; // } // interface BackEndConnector { // saveMissing( // languages, // namespace, // key, // fallbackValue, // isUpdate, // options // ): void; // } // } declare module 'i18next' { interface InitOptions { allLanguages: string[]; defaultLanguage: string; } interface BackEndConnector { saveMissing( languages, namespace, key, fallbackValue, isUpdate, options ): void; } } // declare module 'http' { // interface IncomingMessage { // // i18n: I18n & { // // options: Config; // // }; // i18n: I18nNext; // lng: string; // } // } export type NextRuntimeConfig = { publicRuntimeConfig: Record; serverRuntimeConfig: Record; }; export type InitConfig = { browserLanguageDetection?: boolean; serverLanguageDetection?: boolean; strictMode?: boolean; defaultLanguage: string; ignoreRoutes?: string[]; localePath?: string; localeStructure?: string; otherLanguages: string[]; localeSubpaths?: Record; use?: any[]; customDetectors?: any[]; shallowRender?: boolean; } & I18nNextInitOptions; export type Config = { // fallbackLng: I18nNextFallbackLng; // fallbackLng?: any; allLanguages: string[]; // whitelist: string[]; // whitelist?: any; // preload: string[]; } & InitConfig; export interface NextI18NextInternals { config: Config; i18n: I18nNext; } export type Trans = (props: TransProps) => any; export type Link = React.ComponentClass; export type Router = SingletonRouter; export type UseTranslation = typeof useTranslation; export type AppWithTranslation =

( Component: React.ComponentType

| React.ElementType

) => any; export type TFunction = I18nNextTFunction; export type I18n = I18nNext; export type WithTranslationHocType = typeof withTranslation; export type WithTranslation = ReactI18nextWithTranslation; export class NextI18Next { constructor(runtimeConfig: NextRuntimeConfig, config: InitConfig); Trans: Trans; Link: Link; Router: Router; i18n: I18nNext; config: Config; useTranslation: UseTranslation; withTranslation: WithTranslationHocType; appWithTranslation: AppWithTranslation; } export default NextI18Next;