Skip to content

False positives for no-unnecessary-type-assertion #187

Closed
@armano2

Description

@armano2

Repro

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/typescript-estree/src/convert.ts#L450

{
  ...
  "rules": {
    "@typescript-eslint/no-unnecessary-type-assertion": "error",
    ...
  },
  "parserOptions": {
    "sourceType": "module",
    "project": [
      "./packages/typescript-estree/tsconfig.json",
      "./packages/parser/tsconfig.json",
      "./packages/eslint-plugin-tslint/tsconfig.json"
    ],
    "ecmaFeatures": {
      "jsx": false
    }
  },
  ...
}

Expected Result
there should not be error on (node as any).externalModuleIndicator

Actual Result

506:24  error  This assertion is unnecessary since it does not change the type of the expression  @typescript-eslint/no-unnecessary-type-assertion

Additional Info
i'm getting a lot of false positives in convert.ts

Versions

package version
@typescript-eslint/eslint-plugin master
@typescript-eslint/parser master
TypeScript ~3.2.1
ESLint ^5.12.1
node X.Y.Z
npm X.Y.Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions