diff --git a/packages/astro/src/components/NewsSummaryItem.astro b/packages/astro/src/components/NewsSummaryItem.astro index c2e663c..684a42e 100644 --- a/packages/astro/src/components/NewsSummaryItem.astro +++ b/packages/astro/src/components/NewsSummaryItem.astro @@ -1,8 +1,9 @@ --- +import type { CollectionEntry } from "astro:content"; import { getBlogImage } from "@/utils/getBlogImage"; interface Props { - post: object; + post: CollectionEntry<"blog">; } const { post: { slug, data: { title, image } } } = Astro.props; diff --git a/packages/astro/src/utils/getBlogImage.ts b/packages/astro/src/utils/getBlogImage.ts index 84c6959..b5e2130 100644 --- a/packages/astro/src/utils/getBlogImage.ts +++ b/packages/astro/src/utils/getBlogImage.ts @@ -3,7 +3,7 @@ import type { ImageMetadata } from "astro"; const images = import.meta.glob<{ default: ImageMetadata }>("/src/assets/blog/*.{jpeg,jpg,png,gif}"); export async function getBlogImage( - filename: string): Promise + filename: string = ""): Promise { if (filename) { // this Vite import method requires that its parameter be a literal string, @@ -12,7 +12,6 @@ export async function getBlogImage( if (images[imagePath]) { return (await images[imagePath]()).default; -// return await images[imagePath](); } console.error(`Missing image: ${imagePath}`);