Next.js Discord

Discord Forum

Strange Type errors with Link and useRouter Hooks

Unanswered
New Guinea Freshwater Crocodile posted this in #help-forum
Open in Discord
New Guinea Freshwater CrocodileOP
I keep getting this kind of type errors and it driving me crazy, using the latest stable version of Next.js:

Example here I got

 router.push("/my-account");

and it giving me this type error:

 Argument of type '"/my-account"' is not assignable to parameter of type 'RouteImpl<"/my-account">'.ts(2345)


I wonder how to fix this or disable that error like those strings are valid according to the Next.js Docs.

4 Replies

are you importing useRouter from "next/navigation"?
New Guinea Freshwater CrocodileOP
yup
What nextjs version are you on and are you using the app router?
New Guinea Freshwater CrocodileOP
Sorry for the late reply but yes I'm using the App Router and using next 14.2.13