fix: bad GetEntryImport
type
This commit is contained in:
parent
63b58119bb
commit
551f5ab56d
1 changed files with 5 additions and 4 deletions
|
@ -12,9 +12,10 @@ import {
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
} from '../runtime/server/index.js';
|
} 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 CollectionToEntryMap = Record<string, GlobResult>;
|
||||||
type GetEntryImport = (collection: string, lookupId: string) => () => Promise<any>;
|
type GetEntryImport = (collection: string, lookupId: string) => Promise<LazyImport>;
|
||||||
|
|
||||||
export function createCollectionToGlobResultMap({
|
export function createCollectionToGlobResultMap({
|
||||||
globResult,
|
globResult,
|
||||||
|
@ -64,7 +65,7 @@ export function createGetCollection({
|
||||||
return render({
|
return render({
|
||||||
collection: entry.collection,
|
collection: entry.collection,
|
||||||
id: entry.id,
|
id: entry.id,
|
||||||
renderEntryImport: getRenderEntryImport(collection, entry.slug),
|
renderEntryImport: await getRenderEntryImport(collection, entry.slug),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -117,7 +118,7 @@ async function render({
|
||||||
}: {
|
}: {
|
||||||
collection: string;
|
collection: string;
|
||||||
id: string;
|
id: string;
|
||||||
renderEntryImport?: ReturnType<GetEntryImport>;
|
renderEntryImport?: LazyImport;
|
||||||
}) {
|
}) {
|
||||||
const UnexpectedRenderError = new AstroError({
|
const UnexpectedRenderError = new AstroError({
|
||||||
...AstroErrorData.UnknownContentCollectionError,
|
...AstroErrorData.UnknownContentCollectionError,
|
||||||
|
|
Loading…
Reference in a new issue