fix: remove some type errors
All checks were successful
Deploy to SFTP Server / build (push) Successful in 17m7s

This commit is contained in:
Max Richter
2025-10-28 15:14:21 +01:00
parent ea5c35ee85
commit 71074a8b49
3 changed files with 10 additions and 9 deletions

View File

@@ -26,7 +26,9 @@ const t = useTranslations(Astro.url);
const link = translatePath(`/${collection}/${id.split("/")[0]}`); const link = translatePath(`/${collection}/${id.split("/")[0]}`);
const hasCover = typeof cover === "string" ? !!cover?.length : !!cover?.src; const image = cover as unknown;
const hasCover = typeof image === "string" ? !!image?.length : !!cover?.src;
--- ---
<Card <Card
@@ -64,7 +66,6 @@ const hasCover = typeof cover === "string" ? !!cover?.length : !!cover?.src;
<Image <Image
hash hash
loader={false} loader={false}
shadow={false}
src={cover as ImageMetadata} src={cover as ImageMetadata}
alt={"cover for " + title} alt={"cover for " + title}
class="right-0 h-full object-cover object-center rounded-none border-l border-neutral" class="right-0 h-full object-cover object-center rounded-none border-l border-neutral"

View File

@@ -15,11 +15,11 @@ interface Props {
thumbnail?: boolean; thumbnail?: boolean;
} }
async function checkImage(image: ImageMetadata) { async function checkImage(image: ImageMetadata):Promise<({height:number,width:number}|undefined)> {
const src = typeof image === "string" ? image : image.src; const src = typeof image === "string" ? image : image.src;
if (!src) return false; if (!src) return ;
try { try {
if (src.startsWith("/@fs") || src.startsWith("/_astro")) return true; if (src.startsWith("/@fs") || src.startsWith("/_astro")) return;
const res = await inferRemoteSize(src); const res = await inferRemoteSize(src);
if (res.format) { if (res.format) {
image.format = res.format; image.format = res.format;
@@ -27,11 +27,11 @@ async function checkImage(image: ImageMetadata) {
} else { } else {
console.log("Failed to load: ", src); console.log("Failed to load: ", src);
} }
return false; return ;
} catch (err) { } catch (err) {
console.log("\n"); console.log("\n");
console.log("Failed to fetch: ", src); console.log("Failed to fetch: ", src);
return false; return ;
} }
} }

View File

@@ -32,7 +32,7 @@ const instructions = resource?.content?.recipeInstructions || [];
<h2 class="text-2xl px-4">Ingredients</h2> <h2 class="text-2xl px-4">Ingredients</h2>
<ul class="list-disc px-10"> <ul class="list-disc px-10">
{ {
ingredients.filter(s => !!s?.length).map((ingredient: string) => ( ingredients.filter((s:string) => !!s?.length).map((ingredient: string) => (
<li set:html={markdownToHtml(ingredient)} /> <li set:html={markdownToHtml(ingredient)} />
)) ))
} }
@@ -41,7 +41,7 @@ const instructions = resource?.content?.recipeInstructions || [];
<h2 class="text-2xl px-4">Steps</h2> <h2 class="text-2xl px-4">Steps</h2>
<ol class="list-decimal px-10"> <ol class="list-decimal px-10">
{ {
instructions.filter(s => !!s?.length).map((ingredient: string) => ( instructions.filter((s:string) => !!s?.length).map((ingredient: string) => (
<li set:html={markdownToHtml(ingredient)} /> <li set:html={markdownToHtml(ingredient)} />
)) ))
} }