typeAssertionStyles
Reports angle-bracket type assertions.
✅ This rule is included in the ts stylistic preset.
TypeScript supports two syntaxes for type assertions: angle-bracket (<Type>value) and as (value as Type).
The angle-bracket syntax is ambiguous with JSX and should be avoided.
Examples
Section titled “Examples”const value = <string>raw;const items = <Array<string>>getData();const value = raw as string;const items = getData() as Array<string>;Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your project doesn’t use JSX and you prefer the angle-bracket syntax for consistency with legacy styles, you might prefer to disable this rule.
