From 01b94a0c040c96664efccf881d534dec6a9d0998 Mon Sep 17 00:00:00 2001 From: xingyu Date: Mon, 6 Nov 2023 09:57:30 +0800 Subject: [PATCH] fix: resolve ts type error --- src/locales/useLocale.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/locales/useLocale.ts b/src/locales/useLocale.ts index 45ffe13..df636da 100644 --- a/src/locales/useLocale.ts +++ b/src/locales/useLocale.ts @@ -2,10 +2,10 @@ * Multi-language related operations */ import { computed, unref } from 'vue' +import type { Locale } from 'ant-design-vue/es/locale' import { i18n } from './setupI18n' import { loadLocalePool, setHtmlPageLang } from './helper' import type { LocaleType } from '@/types/config' - import { useLocaleStoreWithOut } from '@/store/modules/locale' interface LangModule { @@ -33,7 +33,8 @@ export function useLocale() { const getShowLocalePicker = computed(() => localeStore.getShowPicker) const getAntdLocale = computed((): any => { - return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale ?? {} + const localeMessage = i18n.global.getLocaleMessage<{ antdLocale: Locale }>(unref(getLocale)) + return localeMessage?.antdLocale ?? {} }) // Switching the language will change the locale of useI18n