diff options
| author | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-12 17:22:33 +0100 |
|---|---|---|
| committer | Joe Carstairs <65492573+Sycamost@users.noreply.github.com> | 2023-08-12 17:22:33 +0100 |
| commit | e0c5ec43f5c2a105dc3c626d7c4bc74b512662f4 (patch) | |
| tree | 4eabdb4b96e960e83f38b5af3b8407d58beb0220 /src/types/TranslationsDictionary.d.ts | |
| parent | b99397f884e41a1018a217c6eb116ed00f922a4f (diff) | |
Parameterises translation
Diffstat (limited to 'src/types/TranslationsDictionary.d.ts')
| -rw-r--r-- | src/types/TranslationsDictionary.d.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/types/TranslationsDictionary.d.ts b/src/types/TranslationsDictionary.d.ts index 5a8a251..d62947c 100644 --- a/src/types/TranslationsDictionary.d.ts +++ b/src/types/TranslationsDictionary.d.ts @@ -1,6 +1,12 @@ import type { defaultLocale } from '../i18n/locales'; import type Locale from './Locale'; -type TranslationsDictionary<Keys> = { - [key in Keys]: { [key in Locale]?: string } & { [key in typeof defaultLocale]: string }; +export type Translation<Params> = (params: { [key in keyof Params]: string }) => string; + +export type TranslationsDictionary<Raw> = { + [key in keyof Raw]: { + [locale in Locale]?: Translation<Parameters<Raw[key][typeof defaultLocale]>[0]>; + } & { + [locale in typeof defaultLocale]: Translation<Parameters<Raw[key][typeof defaultLocale]>[0]>; + }; }; |
