Files
clash-verge-rev/src/types/react-i18next.d.ts
T
Slinetrac c672a6fef3 refactor: lint (#6511)
* refactor: lint

* chore: remove eslint-plugin/config-prettier
2026-03-15 07:40:11 +00:00

40 lines
1.0 KiB
TypeScript

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<Key extends string> = string extends Key
? string
: Key extends TranslationKey
? Key
: never
type BaseTFunction = UseTranslationResponse<Namespace, undefined>[0]
type TypedTFunction = BaseTFunction &
TFunction &
(<Key extends string>(
key: EnforcedTranslationKey<Key>,
options?: TOptions | string,
) => string) &
(<Key extends string>(
key: readonly EnforcedTranslationKey<Key>[],
options?: TOptions | string,
) => string)
declare module 'react-i18next' {
function useTranslation<KPrefix extends string = undefined>(
ns?: Namespace | Namespace[],
options?: UseTranslationOptions<KPrefix>,
): [t: TypedTFunction, i18n: i18n, ready: boolean] & {
t: TypedTFunction
i18n: i18n
ready: boolean
}
}