Skip to content

Commit

Permalink
Fix TypeScript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fwextensions committed Jan 16, 2024
1 parent 3f32d4f commit 63d02f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/astro/src/components/NewsSummaryItem.astro
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 1 addition & 2 deletions packages/astro/src/utils/getBlogImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ImageMetadata | null>
filename: string = ""): Promise<ImageMetadata | null>
{
if (filename) {
// this Vite import method requires that its parameter be a literal string,
Expand All @@ -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}`);
Expand Down

0 comments on commit 63d02f3

Please sign in to comment.