summaryrefslogtreecommitdiff
path: root/src/types/TranslationsDictionary.d.ts
blob: 47ee7f4a082afa348b8699da73c68b4e7ef1e56b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import type { defaultLocale } from '$i18n/locales';
import type Locale from './Locale';

export type Translation<ParamsHash extends object> = (params: ParamsHash) => string;
export type LocalesTranslationHash<ParamsHash extends object> = {
  [locale in Locale]?: Translation<ParamsHash>;
} & {
  [locale in typeof defaultLocale]: Translation<ParamsHash>;
};

export type TranslationsDictionary<Raw> = {
  readonly [key in keyof Raw]: LocalesTranslationHash<
    Parameters<Raw[key][typeof defaultLocale]>[0]
  >;
};