Skip to content

Commit

Permalink
chore: add i18n type safety (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
R894 authored Jan 21, 2024
1 parent 2a5bacc commit c1c176a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/layout/sidebar/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function getItem(
const MainMenu = () => {
const { t } = useTranslation()
const items: MenuItem[] = PAGES.map((itm) => {
return getItem(<Link to={t(itm.path)}>{t(itm.label)}</Link>, itm.path, itm.icon)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return getItem(<Link to={t(itm.path as any)}>{t(itm.label as any)}</Link>, itm.path, itm.icon)
})

const location = useLocation()
Expand Down
6 changes: 4 additions & 2 deletions src/locale/allTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ i18n.use(initReactI18next).init({
})

declare module 'i18next' {
interface CustomResourcesTypeOptions {
translation: typeof translationsHE
interface CustomTypeOptions {
resources: {
translation: typeof translationsHE
}
}
}

Expand Down

0 comments on commit c1c176a

Please sign in to comment.