我想这样定义jsx:
<table style={{'--length': array.lenght}}>
<tbody>
<tr>{array}</tr>
</tbody>
</table>
我在CSS中使用了--length,我还有一个单元格,有--count,它使用CSS伪 Select 器(使用计数器hack)显示count.
但是typescript抛出了错误:
TS2326: Types of property 'style' are incompatible.
Type '{ '--length': number; }' is not assignable to type 'CSSProperties'.
Object literal may only specify known properties, and ''--length'' does not exist in type 'CSSProperties'.
是否可以更改样式属性的类型以接受CSS变量(自定义属性),或者是否有方法强制样式对象使用任何样式属性?