Skip to content

Fix TypeScript build error for blog frontmatter fields#37

Merged
huangyiirene merged 2 commits intocopilot/fix-homepage-font-colorfrom
copilot/fix-error-in-workflow-step
Jan 20, 2026
Merged

Fix TypeScript build error for blog frontmatter fields#37
huangyiirene merged 2 commits intocopilot/fix-homepage-font-colorfrom
copilot/fix-error-in-workflow-step

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 20, 2026

The CI build was failing because blog posts used custom frontmatter fields (date, author, tags) that weren't typed in the fumadocs-mdx schema. Type casts (as any) masked this until TypeScript compilation.

Changes

source.config.ts

  • Configure blog schema via docs.schema property with extended frontmatter
  • Use z.coerce.string() for date field to handle YAML's auto-parsing to Date objects

source.ts

  • Remove as any casts to enable type inference

page.tsx

  • Add BlogPostData interface and type assertions for custom fields
  • Preserve original page.data.body access for MDX component
// Before: unsafe cast hid the missing schema
export const blog = defineDocs({
  dir: '../../content/blog',
}) as any;

// After: explicit schema configuration
const blogSchema = frontmatterSchema.extend({
  date: z.coerce.string().optional(),
  author: z.string().optional(),
  tags: z.array(z.string()).optional(),
});

export const blog = defineDocs({
  dir: '../../content/blog',
  docs: { schema: blogSchema },
});
Original prompt

引用: https://github.com/objectstack-ai/spec/actions/runs/21161689880/job/60857524435#step:8:1


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 20, 2026

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

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 20, 2026 7:28am

Request Review

- Remove `as any` type casts from source.config.ts and source.ts
- Properly configure fumadocs-mdx blog schema with extended frontmatter fields
- Use z.coerce.string() for date field to handle YAML Date objects
- Add BlogPostData interface and type assertions in blog page component
- Build now passes successfully

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error in workflow step execution Fix TypeScript build error for blog frontmatter fields Jan 20, 2026
Copilot AI requested a review from hotlong January 20, 2026 07:31
@github-actions github-actions bot added documentation Improvements or additions to documentation size/m labels Jan 20, 2026
@huangyiirene huangyiirene marked this pull request as ready for review January 20, 2026 07:54
@huangyiirene huangyiirene merged commit 526ccb0 into copilot/fix-homepage-font-color Jan 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants