Skip to content

getImageProps and alt text #70443

Answered by icyJoseph
ulrichgreen asked this question in Help
Sep 25, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Interesting... the getImageProps function, does pick some properties from the arguments passed to it, and it just echoes the rest.

As you point out, alt, doesn't really have to be removed from the typing of what getImageProps returns though. It is required to pass it, and it will be echo'ed out.

Since they have this explicit type check, for ImgProps:

  const props: ImgProps = {
    ...rest,
    loading: isLazy ? 'lazy' : loading,
    fetchPriority,
    width: widthInt,
    height: heightInt,
    decoding,
    className,
    style: { ...imgStyle, ...placeholderStyle },
    sizes: imgAttributes.sizes,
    srcSet: imgAttributes.srcSet,
    src: overrideSrc || imgAttributes.src,
  }

Accidenta…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ulrichgreen
Comment options

@icyJoseph
Comment options

Answer selected by ulrichgreen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants