Syntax checker vs Object.assign

I have an edge action which uses a set of different predefined objects for the return data. For instance I have an object containing what is needed for polling for data via Modbus, and this object is combined with e.g. an object setting the IO.

I have used Object.assign to perform the merging of objects like this:

var energiyaSampleOn = {“dh://Energiya/uc_input1/enable”: [true]};
return Object.assign({}, energiyaSampleOn, {“vr://SampleState”: [“powerUpIO”]});
It works very nicely on my FX30 but now I am no longer allowed to save the script due to this error message:
“Property ‘assign’ does not exist on type ‘ObjectConstructor’. Do you need to change your target library? Try changing the lib compiler option to ‘es2015’ or later.”

Is there a better way of merging the objects? Or at least a workaround. On a different note, I find the “no save on syntax error” very intrusive as you once in a while need to save your current work (as a draft) even though you have a syntax error.

OK, I found this simple object extension function that seems to do the job.
function extend(obj, src) {
Object.keys(src).forEach(function(key) { obj[key] = src[key]; });
return obj;

Found at