问题描述
如何配置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'
}