title: typescript error when using same event handler for two types of events
body: <p>I have a function that takes two different event objects one for touchscreen and the other for mouse input. TypeScript shows an error when accessing types only available to one of the events.</p>
  <pre><code>const desktopDragHandler = (
      e: React.MouseEvent&lt;HTMLDivElement&gt; | React.TouchEvent&lt;HTMLDivElement&gt;
  ) =&gt; {
          //depending on touch screen or mouse we have different properties
          let position = { x: 0, y: 0 };
          if (e.type === &quot;touchmove&quot;) { //we have a touch event
              let evt = typeof e.originalEvent === &quot;undefined&quot; ? e : e.originalEvent;
              let touch = evt.touches[0] || evt.changedTouches[0];
              position.x = touch.pageX;
              position.y = touch.pageY;
          } else { //we have a mouse event
              position.x = e.clientX;
              position.y = e.clientY;
          }
  }
  </code></pre>
  <p>ts shows error when accessing <code>e.originalEvent</code> and <code>e.clientX or e.clientY</code>. how to resolve the type error here?</p>