import "react-i18next"; import type { i18n, Namespace, TOptions, TFunction } from "i18next"; import type { UseTranslationOptions, UseTranslationResponse, } from "react-i18next"; import type { TranslationKey } from "./generated/i18n-keys"; type EnforcedTranslationKey = string extends Key ? string : Key extends TranslationKey ? Key : never; type BaseTFunction = UseTranslationResponse[0]; type TypedTFunction = BaseTFunction & TFunction & (( key: EnforcedTranslationKey, options?: TOptions | string, ) => string) & (( key: readonly EnforcedTranslationKey[], options?: TOptions | string, ) => string); declare module "react-i18next" { function useTranslation( ns?: Namespace | Namespace[], options?: UseTranslationOptions, ): [t: TypedTFunction, i18n: i18n, ready: boolean] & { t: TypedTFunction; i18n: i18n; ready: boolean; }; }