From 63d02f39059ac899b7f2e759675be48c8ed9ebf1 Mon Sep 17 00:00:00 2001 From: John Dunning Date: Mon, 15 Jan 2024 18:21:11 -0800 Subject: [PATCH] Fix TypeScript errors --- packages/astro/src/components/NewsSummaryItem.astro | 3 ++- packages/astro/src/utils/getBlogImage.ts | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) 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}`);