"Invalid left-hand side in assignment" on "else if"
evperedadiaz opened this issue · 2 comments
evperedadiaz commented
This code is minified with errors, using version 10.0.0:
Source Code:
if (tipoCarga === "VAL1") {
url = "operations/createObj1";
} else if (tipoCarga === "VAL2") {
url = "operations/createObj2";
} else if (tipoCarga === "VAL3") {
url = "operations/createObj3";
} else if (tipoCarga === "VAL4") {
url = "operations/createObj4";
}
Minified code is:
if(tipoCarga==="VAL1"){url="operations/createObj1"} else if(tipoCarga==="VAL2"){url="operations/createObj2"} else if(tipoCarga==="VAL3"){url="operations/createObj3"}else tipoCarga==="VAL4"&&url="operations/createObj4";
The error is: Uncaught SyntaxError: Invalid left-hand side in assignment
cigaly commented
I have more or less identical problem. When using version 10.0.0 to minify output from TypeScript like this one very simplified:
var HW;
(function (HW) {
HW.hello = "Hello, World!";
})(HW || (HW = {}));
resulting code is
var HW;(function(a){a.hello="Hello, World!"})(HW||HW={});
which is resulting in same error as above.
However, when using previous (9.2.0) version, result is correct:
var HW;!function(l){l.hello="Hello, World!"}(HW||(HW={}));
coderaiser commented
Fixed in @putout/minify
and @putout/printer
. Please re-install Minify and try again.