Check for property existance for GetImageResult.

Fix npm run build fails due to getImage() return type GetImageResult #364
This commit is contained in:
dudi levy
2024-02-22 19:10:40 +02:00
parent b15682b2cd
commit 74e2435570

View File

@ -79,9 +79,9 @@ export const adaptOpenGraphImages = async (
if (typeof _image === 'object') { if (typeof _image === 'object') {
return { return {
url: typeof _image.src === 'string' ? String(new URL(_image.src, astroSite)) : 'pepe', url: 'src' in _image && typeof _image.src === 'string' ? String(new URL(_image.src, astroSite)) : 'pepe',
width: typeof _image.width === 'number' ? _image.width : undefined, width: 'width' in _image && typeof _image.width === 'number' ? _image.width : undefined,
height: typeof _image.height === 'number' ? _image.height : undefined, height: 'height' in _image && typeof _image.height === 'number' ? _image.height : undefined,
}; };
} }
return { return {