From ccab527056bfaff373f2fe88356603d5d854877e Mon Sep 17 00:00:00 2001 From: paring Date: Wed, 20 Mar 2024 15:25:27 +0900 Subject: [PATCH] fix: extra lang section typing --- src/lib/utils/translation-constants.d.ts | 7 +++++++ src/lib/utils/translation.ts | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/lib/utils/translation-constants.d.ts diff --git a/src/lib/utils/translation-constants.d.ts b/src/lib/utils/translation-constants.d.ts new file mode 100644 index 0000000..2079034 --- /dev/null +++ b/src/lib/utils/translation-constants.d.ts @@ -0,0 +1,7 @@ +declare global { + namespace ADOFAIGG_UI { + type ExtraLangSections = [] + } +} + +export {} diff --git a/src/lib/utils/translation.ts b/src/lib/utils/translation.ts index 756213d..89cc658 100644 --- a/src/lib/utils/translation.ts +++ b/src/lib/utils/translation.ts @@ -11,12 +11,11 @@ export const availableLanguages: LangResponse[] = langs export const fallbackLang = 'en' -export type ExtraLangSections = [] const registeredLangSections: string[] = [] const langSections = ['common', 'footer', 'nav'] as const -export type LangSection = (typeof langSections)[number] | ExtraLangSections[number] +export type LangSection = (typeof langSections)[number] | ADOFAIGG_UI.ExtraLangSections[number] export type LangData = Record // eslint-disable-next-line @typescript-eslint/ban-types export type StringTranslationKey = `${LangSection}:` | (`${LangSection}:${string & {}}` & {})