diff --git a/.changeset/eleven-planes-deliver.md b/.changeset/eleven-planes-deliver.md new file mode 100644 index 000000000..c3d44b459 --- /dev/null +++ b/.changeset/eleven-planes-deliver.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +MarkdownInstance: Persist frontmatter type into the return of `.default()` diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 137fb3b85..7dd341d6f 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -760,7 +760,7 @@ export interface MarkdownInstance> { getHeaders(): Promise; default: () => Promise<{ metadata: MarkdownMetadata; - frontmatter: MarkdownContent; + frontmatter: MarkdownContent; $$metadata: Metadata; default: AstroComponentFactory; }>; @@ -817,10 +817,9 @@ export interface MarkdownParserResponse extends MarkdownRenderingResult { * The `content` prop given to a Layout * https://docs.astro.build/guides/markdown-content/#markdown-layouts */ -export interface MarkdownContent { - [key: string]: any; +export type MarkdownContent = Record> = T & { astro: MarkdownMetadata; -} +}; /** * paginate() Options