3 ms·
Yeah, I've only been working in TS for about a year, but I still find this sort of thing wrong. It's easy to get wrong since it overloads syntax (casting vs bo
by black_puppydog 6y ago
Yeah, I've only been working in TS for about a year, but I still find this sort of thing wrong.
It's easy to get wrong since it overloads syntax (casting vs boolean ops) and is very hard to google (as many operators are).
- WorldMaker 6y agoYeah, I've started to migrate to the habit of using Boolean(expr) instead of !!expr simply because it is explicit about intent. I've seen projects with that as a tslint/eslint rule to never allow !! and instead it suggests Boolean() and I haven't quite done that in my own projects, but have considered it.