配置 TSLint 以显示静态只读名称的错误:'some_string'



如何配置TSLint以显示以下代码的错误?

static readonly frame: 'frame';

目的是写:

static readonly frame = 'frame';

我不知道有谁会这样做。你可以写一个自定义的tho。

毕竟,我想建议您不要在typescript类中使用静态只读字段。请考虑在ts文件中使用常量,而不是

const frame = 'frame';
// compiler would show an error on const frame: 'frame'
export class YourClass {
// instead of static readonly frame = 'frame'
}

相关内容

最新更新