Consistent MD frontmatter typing (#5294)
* consistent MD frontmatter typing * changeset
This commit is contained in:
parent
edfbb0c9dd
commit
ae41f25e10
2 changed files with 11 additions and 4 deletions
5
.changeset/thin-trains-complain.md
Normal file
5
.changeset/thin-trains-complain.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Consistent Markdown frontmatter typing (`MarkdownAstroData["frontmatter"]` in particular was `object` before)
|
|
@ -1005,6 +1005,8 @@ export interface MarkdownInstance<T extends Record<string, any>> {
|
|||
default: AstroComponentFactory;
|
||||
}
|
||||
|
||||
type MD = MarkdownInstance<Record<string, any>>;
|
||||
|
||||
export interface MDXInstance<T extends Record<string, any>>
|
||||
extends Omit<MarkdownInstance<T>, 'rawContent' | 'compiledContent'> {
|
||||
/** MDX does not support rawContent! If you need to read the Markdown contents to calculate values (ex. reading time), we suggest injecting frontmatter via remark plugins. Learn more on our docs: https://docs.astro.build/en/guides/integrations-guide/mdx/#inject-frontmatter-via-remark-or-rehype-plugins */
|
||||
|
@ -1083,9 +1085,7 @@ export interface ManifestData {
|
|||
}
|
||||
|
||||
export interface MarkdownParserResponse extends MarkdownRenderingResult {
|
||||
frontmatter: {
|
||||
[key: string]: any;
|
||||
};
|
||||
frontmatter: MD['frontmatter'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1410,7 +1410,9 @@ export interface SSRResult {
|
|||
_metadata: SSRMetadata;
|
||||
}
|
||||
|
||||
export type MarkdownAstroData = { frontmatter: object };
|
||||
export type MarkdownAstroData = {
|
||||
frontmatter: MD['frontmatter'];
|
||||
};
|
||||
|
||||
/* Preview server stuff */
|
||||
export interface PreviewServer {
|
||||
|
|
Loading…
Reference in a new issue