amannn / next-intl

🌐 Internationalization (i18n) for Next.js
https://next-intl-docs.vercel.app
MIT License
2.58k stars 236 forks source link

Wrong document #1235

Closed phongtran231 closed 3 months ago

phongtran231 commented 3 months ago

Description

In this document we can use router.push(object with path here) https://next-intl-docs.vercel.app/docs/routing/navigation#apis

but in code useRouter: () => { push: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & { locale?: AppLocales[number] | undefined; }) | undefined) => void; replace: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & { locale?: AppLocales[number] | undefined; }) | undefined) => void; prefetch: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions & { locale?: AppLocales[number] | undefined; }) | undefined) => void; back(): void; forward(): void; refresh(): void; }; router.push have to use string as first param

Verifications

Mandatory reproduction URL

https://github.com/amannn/next-intl-bug-repro-app-router

Reproduction description

const router = useRouter();

router.push({ pathname: 'my path string', })

Expected behaviour

can use with const router = useRouter();

router.push({ pathname: 'my path string', })

amannn commented 3 months ago

Duplicate of https://github.com/amannn/next-intl/issues/1240#issuecomment-2288503458