如何为 Google AMP 中使用方括号的 JSX 属性编写类型声明?

How can I write a Type Declaration for a JSX attribute from Google AMP that uses square brackets?

要使用 AMP 的 binding feature,您必须使用特殊属性将元素的 属性 括在方括号中并将其链接到表达式。这是来自 AMP 的示例:

<p [text]="'Hello ' + foo">Hello World</p>

<button on="tap:AMP.setState({foo: 'amp-bind'})">

问题是,目前没有@types/amp,并且 Typescript 在我的 JSX 中的第一个 [ 处抛出错误,说 [ts] identifier expected。弄乱它我也有 [ts] Left side of comma operator is unused and has no side effects.

这很可能可以通过正确的 Typescript 类型声明来解决。有什么建议么?

根据amp-bind component文件:

Bracket characters [ and ] in attribute names can be problematic when writing XML (e.g. XHTML, JSX) or writing attributes via DOM APIs. In these cases, use the alternative syntax data-amp-bind-x="foo" instead of [x]="foo". For example:

<p data-amp-bind-text="'Hello ' + foo">Hello World</p>