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

"ignore-rhs" causes weird failures #4746

Closed
pgsandstrom opened this issue May 28, 2019 · 0 comments · Fixed by #4833
Closed

"ignore-rhs" causes weird failures #4746

pgsandstrom opened this issue May 28, 2019 · 0 comments · Fixed by #4833

Comments

@pgsandstrom
Copy link

Bug Report

  • TSLint version: 5.16.0
  • TypeScript version: 3.3.4000
  • Running TSLint via: CLI

TypeScript code being linted

let bool1:boolean = true
let bool2:boolean = true
let obj:{}|undefined = {}

const func = () => {
  if(bool1 && obj && bool2) {
    return 1
  } else {
    return 2
  }
}

with tslint.json configuration:

{
  "rules": {
    "strict-boolean-expressions": [true, "allow-undefined-union", "ignore-rhs"]
  }
}

Actual behavior

Get error This type is not allowed in the operand for the '&&' operator because it unions more than one truthy/falsy type. Allowed types are boolean or undefined-union.

Expected behavior

It should pass. If I remove "ignore-rhs" from tslint.json it passes.

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

Successfully merging a pull request may close this issue.

2 participants