function isType1( data: Type1 | Type2 ): section is Type1 { const isType1 = Object.prototype.hasOwnProperty.call(data, "my prop in type 1"); return isType1; }
if (isType1(data)) { // Use as Type1 } else { // Use as Type2 }