Is there a way to force Coffeescript to always convert
if x?
console.log "hello"
to
if (typeof x !== "undefined" && x !== null) {
console.log("hello");
}
The reason I'm asking is because if we have the following:
x = "hello"
if x?
console.log "hello"
It gets converted to:
var x;
x = "hello";
if (x != null) {
console.log("hello");
}
While this is not a problem in the code above, it is problematic in functions to which an undefined variable is passed.