Skip to content

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Oct 20, 2025

Changes

Testing

N/A, type only

Docs

Adds proper TypeScript support for passing custom components to MDX Content component via the components prop.

Changes:
- Add MDXContentProps interface defining the components prop
- Add MDXContent type that extends AstroComponentFactory with typed props
- Update MDX render type to use MDXContent instead of plain function
- Maintains link to base AstroComponentFactory type via intersection

This addresses part of issue #14490 by providing TypeScript intellisense and type checking for the components prop when using await render().

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link

changeset-bot bot commented Oct 20, 2025

🦋 Changeset detected

Latest commit: e728491

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: integration Related to any renderer integration (scope) pkg: astro Related to the core `astro` package (scope) docs pr labels Oct 20, 2025
Adds changeset documenting the new TypeScript support for the components prop on MDX Content component.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link

codspeed-hq bot commented Oct 20, 2025

CodSpeed Performance Report

Merging #14591 will not alter performance

Comparing claude/investigate-astro-issue-011CUJzAzC4bZ5oJVmmmUqBu (e728491) with main (577d051)1

Summary

✅ 6 untouched

Footnotes

  1. No successful run was found on main (c96711d) during the generation of this report, so 577d051 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@matthewp matthewp marked this pull request as ready for review October 20, 2025 20:14
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting for docs!

* <Content components={{ h1: MyCustomH1, img: MyImage }} />
* ```
*/
export interface MDXContentProps {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling @ArmandPhilippot -- I don't think we document Markdown or MDX types, really. So, nothing to update, but is this something we should have?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's useful to document these types like we do the ones where we expect users to import them into their project. They seem more useful internally than in a user project. And I don't recall seeing users complain those types are not documented/would have been useful.

We document MarkdownInstance in plain text in Importing Markdown (without the type name). Well, I guess we could move/repeat this in the Import statements reference. And, we will document components for MDX.

So, I think it's fine as it is!

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

Labels

docs pr pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing components to <Content /> when using await render() is undocumented, lacks type support, and differs from MDXProvider

5 participants