Skip to content

Commit

Permalink
Allow globbed mdx files to have typed frontmatter (#4108)
Browse files Browse the repository at this point in the history
* Allow frontmatter typing for .mdx files from glob

`Astro.glob<T>("*.md")` is special cased to allow `T` to be a type for the frontmatter in the markdown. Since .mdx files also get frontmatter added to the globbed result, let's type it as such.

* Add changeset

Co-authored-by: Nate Moore <[email protected]>
Co-authored-by: Tony Sullivan <[email protected]>
  • Loading branch information
3 people authored Aug 3, 2022
1 parent a28b441 commit 08432d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-tables-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Allow globbed mdx files to have typed frontmatter
1 change: 1 addition & 0 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export interface AstroGlobalPartial {
*/
glob(globStr: `${any}.astro`): Promise<AstroInstance[]>;
glob<T extends Record<string, any>>(globStr: `${any}.md`): Promise<MarkdownInstance<T>[]>;
glob<T extends Record<string, any>>(globStr: `${any}.mdx`): Promise<MarkdownInstance<T>[]>;
glob<T extends Record<string, any>>(globStr: string): Promise<T[]>;
/**
* Returns a [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) object built from the [site](https://docs.astro.build/en/reference/configuration-reference/#site) config option
Expand Down

0 comments on commit 08432d5

Please sign in to comment.