Community
Participate
Working Groups
Warning "Type mismatch: cannot convert from String to Boolean" is shown on each statement like <code>x = x || "default value";</code>. Steps to Reproduce: Create in JavaScript project JavaScript file with code: function defVal(x) { x = x || "default value"; return x; } Actual Results: warning about type mismatch. Expected Results: no warning, this style of default value assignment is widely used. Platform: Eclipse Indigo, JavaScript Development Tools 1.3.0.
This bug is still present in Eclipse Java EE IDE for Web Developers. Version: Juno Release Build id: 20120322-1740
I'm getting the same kind of thing with this code: function foo() { var temp = {}; if (true) { temp = 1; } return temp; } (Type mismatch: cannot convert from Number to ___anonymous6554_6555) If I change it to: function foo() { var temp = new Object(); if (true) { temp = 1; } return temp; } the warning goes away, but then jsHint warns me to use object literal notation. Grrr...
This error is gone in WTP 3.5.1. Checked against 7/18 build.