image: ImageProps | NonNullable<ReactElement>;
type ImageProps = Omit<JSX.IntrinsicElements['img'], 'src' | 'srcSet' | 'ref' | 'alt' | 'width' | 'height' | 'loading'> & {
src: string | StaticImport;
alt: string;
width?: number | `${number}`;
height?: number | `${number}`;
...
}
{image.src ? (
<Image
{...{
...image,
className: "z-10 h-full object-cover w-full",
}}
/>
) : image}
Why does image.src give me a error line?
I would imagine that this scenario is a clear cut case. That ReactElement doesn't have a key of src, so the presence of a src in the object image would have to be a type of ImageProps. If it didnt have a source it would be an React element. What am I missing here or have i misunderstood this type of narrowing?