Please add a check so that compilation fails (instead of runtime error) in case of the following code:
import Toybox.Application;
using Toybox.Application as App;
import Toybox.Application.Properties;
import Toybox.Lang;
function getConfigNumber(key as PropertyKeyType, defaultValue as Number) as Number {
var value = getConfig(key);
if (value != null && !(value instanceof Lang.Number)) {
if (value instanceof String) { // in this line
value = value.toNumber();
} else if (value instanceof Boolean) { // and this line
value = value ? 1 : 0;
}
}
if (value == null) {
value = defaultValue;
}
return value;
}
In the above code at least on some devices (i.e: vívoactive® 4: 6.90 ) I got an error: Error Name: Symbol Not Found Error
On the line: value instanceof String
This could be easily caught during compilation.