Check out example codes for "typescript add property if not exist, merge if it exists". It will help you in understanding the concepts better.

Code Example 1

Object.keys(obj2).forEach(function(key) {
    if (key in obj1) { // or obj1.hasOwnProperty(key)
        obj1[key] = obj2[key];
    }
});

Learn ReactJs, React Native from akashmittal.com