Skip to content

Commit

Permalink
fix(i18n): type error
Browse files Browse the repository at this point in the history
  • Loading branch information
chengpeiquan committed Oct 28, 2024
1 parent 90165c5 commit 3d39c68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/config/locale-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type Locale = Locales[number]

export const defaultLocale: Locale = 'zh'

export const localePrefix: LocalePrefix<Locales> = 'as-needed'
export const localePrefix: LocalePrefix<Locales, 'as-needed'> = 'as-needed'

export const pathnames: Pathnames<typeof locales> = {
'/': '/',
Expand Down
12 changes: 9 additions & 3 deletions src/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { createLocalizedPathnamesNavigation } from 'next-intl/navigation'
import { localePrefix, locales, pathnames } from '@/config/locale-config'
import { createNavigation } from 'next-intl/navigation'
import {
defaultLocale,
localePrefix,
locales,
pathnames,
} from '@/config/locale-config'

export const { Link, getPathname, redirect, usePathname, useRouter } =
createLocalizedPathnamesNavigation({
createNavigation({
locales,
pathnames,
localePrefix,
defaultLocale,
})

0 comments on commit 3d39c68

Please sign in to comment.