最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Property 'srcset' does not exist on type 'DetailedHTMLProps<ImgHTMLAttributes&lt

programmeradmin0浏览0评论

Can someone help with the TypeScript error:

Property 'srcset' does not exist on type 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>'.

I can't figure out what is going wrong. I also tried this solution, but no result:

declare global {
  namespace JSX {
      interface IntrinsicElements {
        srcset: React.DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>
      }
  }
}

Can someone help with the TypeScript error:

Property 'srcset' does not exist on type 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>'.

I can't figure out what is going wrong. I also tried this solution, but no result:

declare global {
  namespace JSX {
      interface IntrinsicElements {
        srcset: React.DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>
      }
  }
}
Share Improve this question asked Jul 17, 2019 at 16:45 Max TravisMax Travis 1,3284 gold badges22 silver badges43 bronze badges 1
  • stackoverflow./a/34695900/367865 – Ouroborus Commented Jul 17, 2019 at 17:32
Add a ment  | 

1 Answer 1

Reset to default 7

The solution is to use srcSet instead of srcset -> Why is React.js removing the srcset tag on <img />?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论