gleb.kudr
gleb.kudr

Reputation: 1508

Restrict assignment in if statements in Typescript

Recently I caught a nasty bug caused by assignment in If statement. I consider if-assignment as a bad pattern for me and I want to turn it off completely to get the compiler varnings instead of actual bugs.

How can I do this in Typescript?

Upvotes: 5

Views: 440

Answers (1)

gleb.kudr
gleb.kudr

Reputation: 1508

I have found this option in TSLinter: https://palantir.github.io/tslint/rules/no-conditional-assignment/

Upvotes: 6

Related Questions