Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add i18n type safety #419

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading