Type assertion can be described in two ways:
<Foo>{ foo: 'bar' };
{ foo: 'bar' } as Foo;
Are there any TSLint rules that forbid the former and enforce the latter?
TSLint has a builtin rule for this very thing: no-angle-bracket-type-assertion
To enable, add the rule to your tslint.json
as follows
{
"rules": {
"no-angle-bracket-type-assertion": true
}
}
There is an auto-fixer for the rule.