-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Statically typed links for Link
returned from createSharedPathnamesNavigation
#396
Comments
next-intl/link
next-intl/link
next-intl/link
next-intl/link
up pls ? |
Since the two issues referenced are closed, can I safely assume localized routes are typed checked? I could not find relevant docs, but so far I'm having no luck and want to make sure I'm not trying to make something work that simply wont.
import { locales } from "@/i18n";
import { createSharedPathnamesNavigation } from "next-intl/navigation";
export const localePrefix = "always"; // Default
export const { Link, redirect, usePathname, useRouter } =
createSharedPathnamesNavigation({ locales, localePrefix }); but the Link exported from here does not give me type errors bad urls: import { Link } from "@/navigation";
export default function Index() {
return (<Link href="/invalidpath">invalid path</Link>); // no type error
} |
next-intl/link
Link
returned from createSharedPathnamesNavigation
@tacomanator Contributions are welcome for this feature btw., in case someone is interested in looking into it! |
Is your feature request related to a problem? Please describe.
Next.js now supports statically typed links, we should support this too in
Link
that is returned fromcreateSharedPathnamesNavigation
. Also rewrites/redirects should be supported now (needs to be validated).Note that the
Link
that is returned fromcreateLocalizedPathnamesNavigation
is already statically typed, this issue only applies tocreateSharedPathnamesNavigation
.Describe the solution you'd like
Compose existing types from Next.js for static typing to work
Describe alternatives you've considered
Leaving the routes untyped as
string
.The text was updated successfully, but these errors were encountered: