Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

strict-comparisons rule complains about comparisons, it should allow #4780

Closed
MaceWindu opened this issue Jul 1, 2019 · 1 comment
Closed

Comments

@MaceWindu
Copy link

Bug Report

  • TSLint version: 5.18.0
  • TypeScript version: 3.5.2
  • Running TSLint via: gulp-tslint

Reproduction using TSLint Playground (not reproduced on playground)

TypeScript code being linted

public static test1(param?: boolean): boolean {
    return param === undefined ? false : param;
}

with tslint.json configuration:

{
    "extends": [],
    "rules": {
        "strict-comparisons": true
    }
}

Actual behavior

ERROR: 31:20  strict-comparisons  Cannot use '===' comparator for type 'undefined'.
ERROR: 35:20  strict-comparisons  Cannot use '===' comparator for type 'undefined'.
ERROR: 39:20  strict-comparisons  Cannot use '===' comparator for type 'undefined'.
ERROR: 43:20  strict-comparisons  Cannot use '===' comparator for type 'null'.
ERROR: 47:20  strict-comparisons  Cannot use '===' comparator for type 'null'.
ERROR: 51:20  strict-comparisons  Cannot use '===' comparator for type 'null'.

Expected behavior

no errors

@MaceWindu
Copy link
Author

Duplicate of #4774
Didn't found at first due to incorrect rule name

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants