From 74e2435570e5d92f5c1e378b280f926a252ee7e7 Mon Sep 17 00:00:00 2001 From: dudi levy <4785835+dudil@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:10:40 +0200 Subject: [PATCH] Check for property existance for GetImageResult. Fix npm run build fails due to getImage() return type GetImageResult #364 --- src/utils/images.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/images.ts b/src/utils/images.ts index b409ff3..9520975 100644 --- a/src/utils/images.ts +++ b/src/utils/images.ts @@ -79,9 +79,9 @@ export const adaptOpenGraphImages = async ( if (typeof _image === 'object') { return { - url: typeof _image.src === 'string' ? String(new URL(_image.src, astroSite)) : 'pepe', - width: typeof _image.width === 'number' ? _image.width : undefined, - height: typeof _image.height === 'number' ? _image.height : undefined, + url: 'src' in _image && typeof _image.src === 'string' ? String(new URL(_image.src, astroSite)) : 'pepe', + width: 'width' in _image && typeof _image.width === 'number' ? _image.width : undefined, + height: 'height' in _image && typeof _image.height === 'number' ? _image.height : undefined, }; } return {