Skip to content

Commit

Permalink
Fixes to content layer render types (#11558)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic authored Jul 26, 2024
1 parent f093238 commit bb36a2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/astro/src/content/data-store.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { promises as fs, type PathLike, existsSync } from 'fs';
import { imageSrcToImportId, importIdToSymbolName } from '../assets/utils/resolveImports.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js';

import type { MarkdownHeading } from '@astrojs/markdown-remark';
const SAVE_DEBOUNCE_MS = 500;

export interface RenderedContent {
html: string;
metadata?: {
imagePaths: Array<string>;
headings?: MarkdownHeading[];
frontmatter?: Record<string, any>;
[key: string]: unknown;
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/types-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ async function writeContentFiles({
dataTypesStr += `${collectionKey}: Record<string, {\n id: string;\n collection: ${collectionKey};\n data: ${dataType};\n}>;\n`;
break;
case 'experimental_content':
dataTypesStr += `${collectionKey}: Record<string, {\n id: string;\n collection: ${collectionKey};\n data: ${dataType};\n render(): ContentLayerRenderer;\n rendered?: RenderedContent \n}>;\n`;
dataTypesStr += `${collectionKey}: Record<string, {\n id: string;\n collection: ${collectionKey};\n data: ${dataType};\n render(): Promise<ContentLayerRenderer>;\n rendered?: RenderedContent \n}>;\n`;
break;
case 'data':
if (collectionEntryKeys.length === 0) {
Expand Down

0 comments on commit bb36a2d

Please sign in to comment.