chore: Fix LocaleReceiver ts define

This commit is contained in:
zombiej 2020-08-22 22:31:20 +08:00
parent 5a3bceea28
commit 40473cfa19

View File

@ -61,8 +61,9 @@ export function useLocaleReceiver<T extends LocaleComponent>(
const componentLocale = React.useMemo(() => {
const locale = defaultLocale || defaultLocaleData[componentName || 'global'];
const localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
return {
...(typeof locale === 'function' ? locale() : locale),
...(typeof locale === 'function' ? (locale as Function)() : locale),
...(localeFromContext || {}),
};
}, [componentName, defaultLocale, antLocale]);