no-unnecessary-type-assertion
Added in v0.1.4Configuration
rslint.config.ts
Rule Details
This rule reports unnecessary assertions, including as, angle-bracket assertions, and non-null assertions (!).
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
Differences from upstream
Rslint keeps assertions that your code relies on. This helps avoid new type errors, lost type information, or changes in behavior after running --fix.
Some assertions are reported without an automatic fix, so their diagnostics remain after --fix. This includes certain assertions split across lines with comments. The rule leaves these assertions in place to preserve your program's behavior.