diff --git a/libs/angular-i18next/src/lib/I18NextService.ts b/libs/angular-i18next/src/lib/I18NextService.ts index cef47c0..160251c 100644 --- a/libs/angular-i18next/src/lib/I18NextService.ts +++ b/libs/angular-i18next/src/lib/I18NextService.ts @@ -56,9 +56,9 @@ export class I18NextService implements ITranslationService { this.i18next = i18nextInstance ?? i18nextGlobal; } - t(key: string | string[], options?: ITranslationOptions | undefined): i18n.DefaultTReturn; - t(key: string | string[] | (string | TemplateStringsArray)[], defaultValue: string, options?: ITranslationOptions | undefined): i18n.DefaultTReturn; - t(key: unknown, defaultValueOrOptions?: unknown, options?: unknown): i18n.DefaultTReturn { + t(key: string | string[], options?: ITranslationOptions | undefined): i18n.TFunctionReturn; + t(key: string | string[] | (string | TemplateStringsArray)[], defaultValue: string, options?: ITranslationOptions | undefined): i18n.TFunctionReturn; + t(key: unknown, defaultValueOrOptions?: unknown, options?: unknown): i18n.TFunctionReturn { const hasDefault = !!defaultValueOrOptions && typeof defaultValueOrOptions === 'string'; this.i18next.t.bind(this.i18next); diff --git a/libs/angular-i18next/src/lib/ITranslationService.ts b/libs/angular-i18next/src/lib/ITranslationService.ts index f30cda9..ec70ef5 100644 --- a/libs/angular-i18next/src/lib/ITranslationService.ts +++ b/libs/angular-i18next/src/lib/ITranslationService.ts @@ -5,7 +5,7 @@ import { $Dictionary as I18Next$Dictionary } from 'i18next/typescript/helpers'; type Modify = Omit & R; -export type ITranslationOptions = i18n.TOptions & I18Next$Dictionary & { defaultValue?: string; }; +export type ITranslationOptions = i18n.TOptions & { defaultValue?: string; }; export type ITranslationService = Modify, { @@ -29,12 +29,12 @@ export type ITranslationService = Modify, { t( key: string | string[], options?: ITranslationOptions, - ): i18n.DefaultTReturn; + ): i18n.TFunctionReturn; t( key: string | string[], defaultValue: string, options?: ITranslationOptions - ): i18n.DefaultTReturn; + ): i18n.TFunctionReturn; format: i18n.FormatFunction; diff --git a/libs/angular-i18next/src/lib/models.ts b/libs/angular-i18next/src/lib/models.ts index bd5ff2e..6ed8c9c 100644 --- a/libs/angular-i18next/src/lib/models.ts +++ b/libs/angular-i18next/src/lib/models.ts @@ -6,6 +6,6 @@ export type PrependPipeOptions = { prependScope?: boolean; prependNamespace?: boolean; }; -export type PipeOptions = i18n.TOptionsBase & I18Next$Dictionary & { defaultValue?: string; } & +export type PipeOptions = i18n.TOptions & { defaultValue?: string; } & FormatPipeOptions & PrependPipeOptions; diff --git a/libs/angular-i18next/src/tests/mocks/MockTranslationService.ts b/libs/angular-i18next/src/tests/mocks/MockTranslationService.ts index e96b5e1..051b3d6 100644 --- a/libs/angular-i18next/src/tests/mocks/MockTranslationService.ts +++ b/libs/angular-i18next/src/tests/mocks/MockTranslationService.ts @@ -35,7 +35,7 @@ export class MockI18NextService implements ITranslationService { t = jest.fn((key: string | string[], optionsOrDefault?: string | i18next.TOptions, - options?: i18next.TOptions): i18next.DefaultTReturn<(i18next.TOptions & { defaultValue: string; })> => { + options?: i18next.TOptions): i18next.TFunctionReturn => { if (key instanceof Array) { return key.length > 0 ? key[0] : ''; }