fix: bad GetEntryImport type

This commit is contained in:
bholmesdev 2023-04-27 11:51:22 -04:00
parent 63b58119bb
commit 551f5ab56d

View file

@ -12,9 +12,10 @@ import {
unescapeHTML,
} from '../runtime/server/index.js';
type GlobResult = Record<string, () => Promise<any>>;
type LazyImport = () => Promise<any>;
type GlobResult = Record<string, LazyImport>;
type CollectionToEntryMap = Record<string, GlobResult>;
type GetEntryImport = (collection: string, lookupId: string) => () => Promise<any>;
type GetEntryImport = (collection: string, lookupId: string) => Promise<LazyImport>;
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<GetEntryImport>;
renderEntryImport?: LazyImport;
}) {
const UnexpectedRenderError = new AstroError({
...AstroErrorData.UnknownContentCollectionError,