Check out example codes for "typescript check if object has key". It will help you in understanding the concepts better.

Code Example 1

myObj.hasOwnProperty('key') // it checks object for particular key and not on prototype

Code Example 2

if ('key' in myObj)

Learn ReactJs, React Native from akashmittal.com