An if statement that is obviously always false, eg. if (false)
, closure removes the statement.
My code looks like this:
if (settings.lang === "en"){
lib.doSomething();
}
settings.lang
is a constant.
/**
* @type {string}
* @const
*/
settings.lang = "fr" ;
So when it equals "fr" the compiler could remove the if
and the definition of lib.doSomething
at compile time. But it doesn't. Is there any way to get it to do that?
Before you ask why I don't just delete that code: for other clients, settings.lang
is set to en
.