如何解决配置TSLint以显示静态只读名称错误:“ some_string”
如何配置TSLint以显示以下代码的错误?
static readonly frame: 'frame';
目的是写:
static readonly frame = 'frame';
解决方法
我不知道执行此操作的任何规则。您可以编写自定义的一个。
毕竟,我想建议您不要在打字稿类中使用静态只读字段。请考虑改用ts文件中的const
const frame = 'frame';
// compiler would show an error on const frame: 'frame'
export class YourClass {
// instead of static readonly frame = 'frame'
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。