Fix TypeScript issue

This commit is contained in:
Nikita Karamov 2023-08-30 12:43:04 +02:00
parent 7f1bb68adb
commit fc8b44849c
No known key found for this signature in database
GPG key ID: 41D6F71EE78E77CD

View file

@ -7,7 +7,11 @@ export function useTranslations(language: string) {
return function t( return function t(
key: keyof (typeof strings)[typeof defaultLanguage], key: keyof (typeof strings)[typeof defaultLanguage],
): string { ): string {
return strings[language]![key] || strings[defaultLanguage]![key] || ""; return (
strings[language as keyof typeof strings][key] ||
strings[defaultLanguage][key] ||
""
);
}; };
} }