Disallow type assertions that do not change the type of an expression.
Such type assertions are considered unnecessary.
// code-linter.json5
{
"rules": {
"@typescript-eslint/no-unnecessary-type-assertion": "error"
}
} const num = 3; export const foo2 = num as number; export const foo3 = 'foo' as string;
plugin:@typescript-eslint/all
For details about how to configure Code Linter check rules, see Code Linter.