![](/img/trans.png)
[英]TSLint: Warning: The 'no-use-before-declare' rule requires type checking
[英]Is there a TSLint rule that forbids the prefixed type assertion syntax?
类型断言可以用两种方式描述:
<Foo>{ foo: 'bar' };
{ foo: 'bar' } as Foo;
是否有任何 TSLint 规则禁止前者并强制执行后者?
TSLint 对此有一个内置规则: no-angle-bracket-type-assertion
要启用,请将规则添加到您的tslint.json
中,如下所示
{
"rules": {
"no-angle-bracket-type-assertion": true
}
}
该规则有一个自动修复程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.