diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts index db565ea63..ca32f5f32 100644 --- a/packages/astro/src/content/runtime.ts +++ b/packages/astro/src/content/runtime.ts @@ -12,9 +12,10 @@ import { unescapeHTML, } from '../runtime/server/index.js'; -type GlobResult = Record Promise>; +type LazyImport = () => Promise; +type GlobResult = Record; type CollectionToEntryMap = Record; -type GetEntryImport = (collection: string, lookupId: string) => () => Promise; +type GetEntryImport = (collection: string, lookupId: string) => Promise; export function createCollectionToGlobResultMap({ globResult, @@ -64,7 +65,7 @@ export function createGetCollection({ return render({ collection: entry.collection, id: entry.id, - renderEntryImport: getRenderEntryImport(collection, entry.slug), + renderEntryImport: await getRenderEntryImport(collection, entry.slug), }); }, }; @@ -117,7 +118,7 @@ async function render({ }: { collection: string; id: string; - renderEntryImport?: ReturnType; + renderEntryImport?: LazyImport; }) { const UnexpectedRenderError = new AstroError({ ...AstroErrorData.UnknownContentCollectionError,