| ▲ | moritzwarhier 4 hours ago | |
I do it this way, but this led to people asking me in reviews why I use NULL^^ My explanation was that it signals intent to me, and is different from some property not being part of the expected object shape or not having been initialized because of some accident or logic failure. Since then, I've sticked to it, and am "allowed" to use NULL ^^ It can lead to some annoying checks in TS for primitively-typed properties, so for these, I still allow explicit usage of undefined when it's simpler given the surrounding code. But I agree with you in principle. Using "undefined" as a "second nullish value" and explicitly checking for it is a programming error. When there's object/areay vs null/undefined, thankfully, the truthiness narrowing often allows me to interface with code relying on "undefined" without explicitly handling this "value" in my own parts of the code base :) | ||