Typescript check if object has property. hasOwn() as a replacement for Object.