Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to content layer render types #11558

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading