Use PageData type for page data assertions#349
Conversation
Replaced anonymous object casts with the defined `PageData` type in `app/sitemap.ts` and `app/docs/layout.tsx`.
Removed redundant null-coalescing fallbacks `?? {}` in `app/sitemap.ts` as the `PageData` type supports optional properties and subsequent logic uses optional chaining.
Imported `PageData` in `app/docs/layout.tsx` to maintain type consistency across the codebase.
Co-authored-by: longsizhuo <114939201+longsizhuo@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR refactors documentation page metadata access to use the centralized PageData type, improving consistency with the existing typed page.data pattern.
Changes:
- Replaced anonymous
page.datacasts withPageData. - Simplified sitemap page data assertions and removed stale fix-oriented comments.
- Added
PageDataimport in the docs layout.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
app/sitemap.ts |
Uses PageData for sitemap date extraction and draft/hidden checks. |
app/docs/layout.tsx |
Uses PageData when selecting locale-specific documentation variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR refactors the codebase to use the centralized
PageDatatype for allpage.dataassertions.Key changes:
app/sitemap.ts:extractDateFromPageto usepage.data as PageDatadirectly.isDraftOrHiddento usepage.data as PageDatadirectly.app/docs/layout.tsx:PageDatafrom@/app/types/doc.(p.data as { lang?: string })with(p.data as PageData)in thechooseVariantfunction.These changes ensure better type safety and consistency, following the project's preference for using the centralized documentation types.
PR created automatically by Jules for task 13987742699219027133 started by @longsizhuo