- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有人可以帮助解决 TypeScript 错误吗:
Property 'srcset' does not exist on type 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>'.
我不知道出了什么问题。我也试过这个解决方案,但没有结果:
declare global {
namespace JSX {
interface IntrinsicElements {
srcset: React.DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>
}
}
}
最佳答案
解决方案是使用srcSet
代替srcset
-> Why is React.js removing the srcset tag on <img />?
关于javascript - 类型 'srcset' 上不存在属性 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57080728/
假设我有一个组件接口(interface),它应该扩展标准 的接口(interface)。元素。写这个有什么区别: interface ComponentProps extends React.De
由于 React 16 现在允许 custom DOM attributes ,我试图在我的 Typescript 代码中利用它: import * as React from 'react';
有人可以帮助解决 TypeScript 错误吗: Property 'srcset' does not exist on type 'DetailedHTMLProps, HTMLImageEleme
我正在使用带有掌侧扩展名的 vue、ts、vite。 在 Vs 代码中,我得到了错误Type '{ class: string; }' is not assignable to type 'Detai
我最近决定将我的代码库从 JS 迁移到 TS 以添加类型检查。我还使用了 styled-components 库。 但是,我遇到了以下问题: error TS2322: Type '{ childre
我最近决定将我的代码库从 JS 迁移到 TS 以添加类型检查。我还使用了 styled-components 库。 但是,我遇到了以下问题: error TS2322: Type '{ childre
在我的 react-typescript-electron 项目中,我有: "devDependencies": { "@types/react": "^17.0.0", "@types/re
我是一名优秀的程序员,十分优秀!