-
Notifications
You must be signed in to change notification settings - Fork 14
Refactor pages and layouts to use PageProps/LayoutProps #314
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors page and layout components to use Next.js 16's type generation feature, replacing manual type definitions with auto-generated PageProps, LayoutProps, and RouteContext types. The changes introduce a typegen task in the build pipeline and update component signatures to leverage these generated types for improved type safety and consistency.
Key changes:
- Added
next typegenscript and turbo task configuration to generate types in.next/types/** - Replaced inline type definitions with
PageProps<route>andLayoutProps<route>for pages and layouts - Updated route handlers to use
RouteContext<route>for better type inference - Fixed searchParams handling in
/post/newto properly handlestring | string[] | undefinedtypes
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| turbo.json | Added typegen task that generates types before type-checking and linting |
| packages/frontpage/package.json | Added typegen script that runs next typegen |
| packages/frontpage/app/(auth)/login/page.tsx | Replaced manual searchParams type with PageProps<"/login"> |
| packages/frontpage/app/(app)/profile/[user]/page.tsx | Updated page and generateMetadata to use PageProps<"/profile/[user]"> |
| packages/frontpage/app/(app)/post/new/page.tsx | Updated to use PageProps<"/post/new"> and added proper handling for searchParams that can be string or string[] |
| packages/frontpage/app/(app)/post/[postAuthor]/[postRkey]/page.tsx | Updated page and generateMetadata to use PageProps<"/post/[postAuthor]/[postRkey]"> |
| packages/frontpage/app/(app)/post/[postAuthor]/[postRkey]/og-image/route.tsx | Replaced manual Params type with RouteContext<route> |
| packages/frontpage/app/(app)/post/[postAuthor]/[postRkey]/layout.tsx | Updated layout to use LayoutProps<"/post/[postAuthor]/[postRkey]"> |
| packages/frontpage/app/(app)/post/[postAuthor]/[postRkey]/_lib/page-data.tsx | Derived PostPageParams from PageProps params for type consistency |
| packages/frontpage/app/(app)/post/[postAuthor]/[postRkey]/[commentAuthor]/[commentRkey]/page.tsx | Updated page and generateMetadata to use PageProps<route> |
| packages/frontpage/app/(app)/post/[postAuthor]/[postRkey]/[commentAuthor]/[commentRkey]/og-image/route.tsx | Updated to use RouteContext<route> and removed unused CommentPageParams import |
| packages/frontpage/app/(app)/post/[postAuthor]/[postRkey]/[commentAuthor]/[commentRkey]/_lib/page-data.tsx | Derived CommentPageParams from PageProps params for type consistency |
No description provided.