diff --git a/site/source/components/utils/EngineContext.tsx b/site/source/components/utils/EngineContext.tsx index c7511f536..95459f404 100644 --- a/site/source/components/utils/EngineContext.tsx +++ b/site/source/components/utils/EngineContext.tsx @@ -8,7 +8,9 @@ import i18n from '../../locales/i18n' export type Rules = Record -const unitsTranslations = Object.entries(i18n.getResourceBundle('fr', 'units')) +const unitsTranslations = Object.entries( + i18n.getResourceBundle('fr', 'units') as Record +) const engineOptions = { getUnitKey(unit: string): string { const key = unitsTranslations diff --git a/site/source/locales/i18n.ts b/site/source/locales/i18n.ts index 92bcf7e01..5bb4c6e46 100644 --- a/site/source/locales/i18n.ts +++ b/site/source/locales/i18n.ts @@ -4,17 +4,23 @@ import unitsTranslations from './units.yaml' export type AvailableLangs = 'fr' | 'en' +interface Units { + fr: Record + en: Record +} + i18next .use(initReactI18next) .init({ resources: { - fr: { units: unitsTranslations.fr }, - en: { units: unitsTranslations.en }, + fr: { units: (unitsTranslations as Units).fr }, + en: { units: (unitsTranslations as Units).en }, }, react: { useSuspense: false, }, }) + // eslint-disable-next-line no-console .catch((err) => console?.error('Error from i18n load', err)) export default i18next diff --git a/site/source/pages/gerer/index.tsx b/site/source/pages/gerer/index.tsx index 55d083e73..4a69173d5 100644 --- a/site/source/pages/gerer/index.tsx +++ b/site/source/pages/gerer/index.tsx @@ -191,7 +191,7 @@ function Home() { const setEntreprise = useSetEntreprise() - const updateEntrprise = + const updateEntreprise = overwrite && !entreprisePending && !entrepriseNotFound && @@ -199,11 +199,11 @@ function Home() { entreprise.siren !== engineSiren useEffect(() => { - if (updateEntrprise) { + if (updateEntreprise) { setEntreprise(entreprise) setOverwrite(false) } - }, [entreprise, setEntreprise, updateEntrprise]) + }, [entreprise, setEntreprise, updateEntreprise]) if ( gérerPath &&