Browse Source

fix(core): Fix i18next typing issues after update

Michael Bromley 6 years ago
parent
commit
41a3e7a569

+ 2 - 2
packages/core/src/api/common/request-context.ts

@@ -23,7 +23,7 @@ export class RequestContext {
     private readonly _session?: Session;
     private readonly _isAuthorized: boolean;
     private readonly _authorizedAsOwnerOnly: boolean;
-    private readonly _translationFn: i18next.TranslationFunction;
+    private readonly _translationFn: i18next.TFunction;
     private readonly _apiType: ApiType;
 
     /**
@@ -36,7 +36,7 @@ export class RequestContext {
         languageCode?: LanguageCode;
         isAuthorized: boolean;
         authorizedAsOwnerOnly: boolean;
-        translationFn?: i18next.TranslationFunction;
+        translationFn?: i18next.TFunction;
     }) {
         const { apiType, channel, session, languageCode, translationFn } = options;
         this._apiType = apiType;

+ 2 - 2
packages/core/src/i18n/i18n.service.ts

@@ -12,7 +12,7 @@ import { ConfigService } from '../config/config.service';
 import { I18nError } from './i18n-error';
 
 export interface I18nRequest extends Request {
-    t: i18next.TranslationFunction;
+    t: i18next.TFunction;
 }
 
 /**
@@ -52,7 +52,7 @@ export class I18nService implements OnModuleInit {
      */
     translateError(req: I18nRequest, error: GraphQLError) {
         const originalError = error.originalError;
-        const t: i18next.TranslationFunction = req.t;
+        const t: i18next.TFunction = req.t;
 
         if (t && originalError instanceof I18nError) {
             let translation = originalError.message;