Browse Source

fix(core): Fix TypeScript TS2502 error in Translation<T> type

Closes #787
Michael Bromley 4 years ago
parent
commit
a4243c41a6
1 changed files with 3 additions and 1 deletions
  1. 3 1
      packages/core/src/common/types/locale-types.ts

+ 3 - 1
packages/core/src/common/types/locale-types.ts

@@ -12,7 +12,9 @@ import { UnwrappedArray } from './common-types';
  */
 export type LocaleString = string & { _opaqueType: 'LocaleString' };
 
-export type TranslatableKeys<T> = { [K in keyof T]: T[K] extends LocaleString ? K : never }[keyof T];
+export type TranslatableKeys<T, U = Omit<T, 'translations'>> = {
+    [K in keyof U]: U[K] extends LocaleString ? K : never;
+}[keyof U];
 
 export type NonTranslateableKeys<T> = { [K in keyof T]: T[K] extends LocaleString ? never : K }[keyof T];