首页 > 解决方案 > 如何抑制 Typescript CSSProperties 错误

问题描述

我正在尝试使用以下代码:

public render() {
    return (
        <div>
            <button style={{WebkitAppearance: '-apple-pay-button'}}/>

        </div>
    );
}

因为目前在 CSSProperties 类型中没有定义苹果支付按钮,所以我收到类型不兼容的错误。

我怎样才能抑制这个错误?

标签: reactjstypescript

解决方案


如果错误来自打字稿使用

// @ts-ignore

如果她来自 tslint

/* tslint:disable */
<button style={{WebkitAppearance: '-apple-pay-button'}}/>
/* tslint:enable */

推荐阅读