我假设
Visual Studio Code中的TypeScript引擎收到了一个更新,现在第一次抱怨HTML元素上的预先存在的自定义道具无效.这是在没有TypeScript的Babel / React / JSX项目中.
<div custom="bar" />
注意:它们(技术上)无效,但我消耗它们,所以我知道我在做什么(这是故意的).
也可以看看
> How do I add attributes to existing HTML elements in TypeScript/JSX?(一年前由我自己发布,不再工作).
> JSX | Type Checking
解决方法
Note: If an attribute name is not a valid JS identifier (like a data-* attribute),it is not considered to be an error if it is not found in the element attributes type.
< div data-custom =“bar”/>
https://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。