Skip to content

[no-unnecessary-condition] Missing string compared to undefined as unnecessary #1591

Closed
@pgsandstrom

Description

@pgsandstrom

Repro

{
  "rules": {
    "@typescript-eslint/no-unnecessary-condition": ["error"],
  }
}
function test(s: string) {
  if (s === undefined) {
    console.log('this will never happen')
  }
}

Expected Result

It should warn about the unnecessary condition

Actual Result

It does not warn about it

Versions

package version
@typescript-eslint/eslint-plugin 2.19.0
@typescript-eslint/parser 2.19.0
TypeScript 3.7.5
ESLint 6.7.2
node 13.8.0
npm 6.13.7

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