False positive error/warning messages

I've noticed a couple of false positive warnings/error messages in the platform when referencing fields on an object that actually do exist. Is there a link to previously reported cases related to this issue?

These errors typically occur when the editor cannot identify the type of the model being passed into the function, e.g.:

function evalItem(item) {
     item.status = 'ok';
     item.save();
}

where item is model type asset with attribute of status.

both of those may be valid fields for a given model type, but the function does not have context of the model type. As a workaround, the following function can be added in these cases to remove the false warnings:

function falsePositiveEval() {
     evalItem(DB.asset.first());
}

This will effectively tell the evalItem function what type to expect, which it can then parse and correctly associate with the correct data model attributes.

1 Like