Sometimes, and I mean just sometimes, it is better to just use ===. For instance, I recently wrote some code where a variable has a value of type Number, but I use "false" to signal the absence of such value (in the sense that the value is not available yet). In that case, I have to use stuff like if(x !== false), because "0" is a valid value in that context.
`if (foo)` and `if (foo === true)` aren't equivalent.
According to the TypedJS annotation for the function they are. The function definition says that obj.valid has to be a boolean, so any other type of falsy input (0, undefined, null, etc) should never be provided as an argument here.
Sure, I agree it is poor style. I guess I assumed because of the context you were saying you would expect the type checker to flag it as an error.
While uglier === is much more specific and enforces types... Which seems germane here.