mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-07-01 04:33:23 +05:30
Fix TS errors
This commit is contained in:
parent
9faf7cf404
commit
75a7de2af2
|
@ -17,10 +17,9 @@ export function getCountriesList(): string[] {
|
||||||
return SUPPORTED_LANGUAGES.map((locale) => localeToCountryCode[locale] || locale);
|
return SUPPORTED_LANGUAGES.map((locale) => localeToCountryCode[locale] || locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
const flagIconLoadingChain: ReadonlyArray<(locale: string) => string | { default: string }> = [
|
const flagIconLoadingChain: ReadonlyArray<(locale: string) => { default: string }> = [
|
||||||
(locale) => require(`./flags/${locale}.svg`),
|
(locale) => require(`./flags/${locale}.svg`),
|
||||||
(locale) => require(`flag-icon-css/flags/4x3/${localeToCountryCode[locale] || locale}.svg`),
|
(locale) => require(`flag-icon-css/flags/4x3/${localeToCountryCode[locale] || locale}.svg`),
|
||||||
() => require('./flags/unknown.svg'),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,13 +33,13 @@ const flagIconLoadingChain: ReadonlyArray<(locale: string) => string | { default
|
||||||
export function getLocaleIconUrl(locale: string): string {
|
export function getLocaleIconUrl(locale: string): string {
|
||||||
for (const flagIconLoadingChainElement of flagIconLoadingChain) {
|
for (const flagIconLoadingChainElement of flagIconLoadingChain) {
|
||||||
try {
|
try {
|
||||||
const mod = flagIconLoadingChainElement(locale);
|
return flagIconLoadingChainElement(locale).default;
|
||||||
|
|
||||||
return mod.default || mod;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!err.message.startsWith('Cannot find module')) {
|
if (!err.message.startsWith('Cannot find module')) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return require('./flags/unknown.svg').default;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ storiesOf('Components/Profile', module).add('Profile', () => (
|
||||||
avatar: '',
|
avatar: '',
|
||||||
token: '',
|
token: '',
|
||||||
}}
|
}}
|
||||||
interfaceLocale={'en'}
|
activeLocale={'en'}
|
||||||
/>
|
/>
|
||||||
</ProfileLayout>
|
</ProfileLayout>
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user