Skip to content

[no-unnecessary-type-assertion] support const assertions #1734

Closed
@xiaoxiangmoe

Description

@xiaoxiangmoe

Repro

{
  "rules": {
    "@typescript-eslint/no-unnecessary-type-assertion": ["error"]
  }
}
const a = [1, 2];
const b = [3, 4];
const c = [...a, ...b] as const;  // This assertion is unnecessary since it does not change the type of the expression.eslint(@typescript-eslint/no-unnecessary-type-assertion)

Expected Result
No Error
Actual Result
See Error
Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.23.0
@typescript-eslint/parser 2.23.0
TypeScript 3.7.5
ESLint 6.8.0
node 13.5.0
npm 6.13.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions