title: React and Typescript: Argument of type is not assignable to parameter of type 'EventListenerOrEventListenerObject'
body: <p>I am trying to add Typescript to my React project:</p>
  
  <pre><code>componentDidMount() {
    document.addEventListener('mousemove', this.handleMouseMove);
  }
  
  private handleMouseMove = (e: React.MouseEvent&lt;HTMLElement&gt;) =&gt; {
    appStore.updateSideWidth(e.pageX);
  }
  </code></pre>
  
  <p>But I got the following errors under <code>this.handleMouseMove</code>:</p>
  
  <pre><code>[ts]
  Argument of type '(e: MouseEvent&lt;HTMLElement&gt;) =&gt; void' is not assignable to parameter of type 'EventListenerOrEventListenerObject'.
  Type '(e: MouseEvent&lt;HTMLElement&gt;) =&gt; void' is not assignable to type 
  'EventListenerObject'.
  Property 'handleEvent' is missing in type '(e: MouseEvent&lt;HTMLElement&gt;) 
  =&gt; void'.
  </code></pre>
  
  <p>I tried:</p>
  
  <p>1) @ts-ignore it works but I am reluctant to do that because that's why I am using Typescript
  2) Use something like:</p>
  
  <pre><code>private handleMouseMove = (e: Event) =&gt; {
    appStore.updateSideWidth((e as React.MouseEvent&lt;HTMLElement&gt;).pageX);
  }
  </code></pre>
  
  <p>But got an error says cannot convert Event to MouseEvent type due to the lack of <code>altKey</code>.</p>
  
  <p>Thanks for the help!</p>