Transform Next.js page.tsx components to use typed route props types based on their file path location.
How to run?
bash
npx codemod@latest next-typed-routes
This codemod automatically transforms Next.js App Router page and layout components to use PageProps<"/foo/bar"> and LayoutProps<"/foo"> types based on their file system location.
What it does:
Converts manual prop type definitions to typed route props
Automatically infers the route path from the file location
Handles dynamic routes like [id], [slug], etc.
Skips route groups like (group) in the path
Skips parallel routes like @modal, @auth in the path