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

问题描述 投票:0回答:1

要使用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类型声明解决。有什么建议?

javascript reactjs typescript amp-html
1个回答
1
投票

根据amp-bind component文档:

© www.soinside.com 2019 - 2024. All rights reserved.