Skip to content

Use PageData type for page data assertions#349

Open
longsizhuo wants to merge 1 commit into
mainfrom
fix-use-pagedata-type-13987742699219027133
Open

Use PageData type for page data assertions#349
longsizhuo wants to merge 1 commit into
mainfrom
fix-use-pagedata-type-13987742699219027133

Conversation

@longsizhuo
Copy link
Copy Markdown
Member

This PR refactors the codebase to use the centralized PageData type for all page.data assertions.

Key changes:

  • In app/sitemap.ts:
    • Cleaned up extractDateFromPage to use page.data as PageData directly.
    • Cleaned up isDraftOrHidden to use page.data as PageData directly.
    • Removed stale "(FIX)" and "[BUILD 修复]" comments.
  • In app/docs/layout.tsx:
    • Imported PageData from @/app/types/doc.
    • Replaced the anonymous cast (p.data as { lang?: string }) with (p.data as PageData) in the chooseVariant function.

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

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>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings May 24, 2026 14:56
@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
involutionhell-github-io Ready Ready Preview, Comment May 24, 2026 3:04pm
website-preview Ready Ready Preview, Comment May 24, 2026 3:04pm

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 documentation page metadata access to use the centralized PageData type, improving consistency with the existing typed page.data pattern.

Changes:

  • Replaced anonymous page.data casts with PageData.
  • Simplified sitemap page data assertions and removed stale fix-oriented comments.
  • Added PageData import 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants