0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Allow globbed mdx files to have typed frontmatter (#4108)

* 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 <natemoo-re@users.noreply.github.com>
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
This commit is contained in:
Alan 2022-08-03 08:45:31 -07:00 committed by GitHub
parent a28b441763
commit 08432d5b01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Allow globbed mdx files to have typed frontmatter

View file

@ -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