diff --git a/examples/with-app-directory/next-translate.d.ts b/examples/with-app-directory/next-translate.d.ts index 870df3f..ed1185a 100644 --- a/examples/with-app-directory/next-translate.d.ts +++ b/examples/with-app-directory/next-translate.d.ts @@ -9,7 +9,9 @@ export interface TranslationsKeys { // Specify here all the namespaces you have... } -export interface TranslateFunction { +type TranslationNamespace = keyof TranslationsKeys; + +export interface TranslateFunction { ( key: TranslationsKeys[Namespace], ...rest: Tail> @@ -17,19 +19,19 @@ export interface TranslateFunction { (template: TemplateStringsArray): string }; -export interface TypeSafeTranslate +export interface TypeSafeTranslate extends Omit { t: TranslateFunction } declare module 'next-translate/useTranslation' { export default function useTranslation< - Namespace extends keyof TranslationsKeys + Namespace extends TranslationNamespace >(namespace: Namespace): TypeSafeTranslate } declare module 'next-translate/getT' { export default function getT< - Namespace extends keyof TranslationsKeys + Namespace extends TranslationNamespace >(locale?: string, namespace: Namespace): Promise> }