-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Closed
Closed
Documentation
Copy link
Labels
ImprovementReport possible improvements to make in our documentationReport possible improvements to make in our documentationlocked
Description
What is the documentation issue?
https://nextjs.org/docs/app/api-reference/config/typescript#statically-typed-links
https://nextjs.org/docs/app/api-reference/functions/use-router
Neither of these pages mention that if you enabled typedRoutes
that router.push()
also does route checking, and attempting to use constructed strings like this will result in a build error:
router.push(`${baseUrl}${filterValue}`);
Is there any context that might help us understand?
The way I fixed this was to cast the string to type Route:
import type { Route } from "next";
...
router.push(`${baseUrl}${filterValue}` as Route);
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/app/api-reference/functions/use-router
sm17p
Metadata
Metadata
Assignees
Labels
ImprovementReport possible improvements to make in our documentationReport possible improvements to make in our documentationlocked