title: Correct TypeScript Type for thunk dispatch?
body: <p>I have an asynchronous redux action and so am using the thunk middleware.</p>
  
  <p>I have <code>mapStateToProps</code>, <code>mapDispatchToProps</code> and <code>connect</code> functions for a component as follows:</p>
  
  <pre><code>const mapStateToProps = (store: IApplicationState) =&gt; {
    return {
      loading: store.products.loading,
      products: store.products.products
    };
  };
  const mapDispatchToProps = (dispatch: any) =&gt; {
    return {
      getAllProducts: () =&gt; dispatch(getAllProducts())
    };
  };
  export default connect(
    mapStateToProps,
    mapDispatchToProps
  )(ProductsPage);
  </code></pre>
  
  <p><strong>This all works but I wondered if is possible to replace the <code>any</code> type on the dispatch parameter in <code>mapDispatchToProps</code>?</strong></p>
  
  <p>I tried <code>ThunkDispatch&lt;IApplicationState, void, Action&gt;</code> but get the following TypeScript error on the connect function:</p>
  
  <pre><code>Argument of type 'typeof ProductsPage' is not assignable to parameter of type 'ComponentType&lt;Matching&lt;{ loading: boolean; products: IProduct[]; } &amp; { getAllProducts: () =&gt; Promise&lt;void&gt;; }, IProps&gt;&gt;'.
    Type 'typeof ProductsPage' is not assignable to type 'ComponentClass&lt;Matching&lt;{ loading: boolean; products: IProduct[]; } &amp; { getAllProducts: () =&gt; Promise&lt;void&gt;; }, IProps&gt;, any&gt;'.
      Types of property 'getDerivedStateFromProps' are incompatible.
        Type '(props: IProps, state: IState) =&gt; { products: IProduct[]; search: string; }' is not assignable to type 'GetDerivedStateFromProps&lt;Matching&lt;{ loading: boolean; products: IProduct[]; } &amp; { getAllProducts: () =&gt; Promise&lt;void&gt;; }, IProps&gt;, any&gt;'.
          Types of parameters 'props' and 'nextProps' are incompatible.
            Type 'Readonly&lt;Matching&lt;{ loading: boolean; products: IProduct[]; } &amp; { getAllProducts: () =&gt; Promise&lt;void&gt;; }, IProps&gt;&gt;' is not assignable to type 'IProps'.
              Types of property 'getAllProducts' are incompatible.
                Type '() =&gt; Promise&lt;void&gt;' is not assignable to type '() =&gt; (dispatch: Dispatch&lt;AnyAction&gt;) =&gt; Promise&lt;void&gt;'.
                  Type 'Promise&lt;void&gt;' is not assignable to type '(dispatch: Dispatch&lt;AnyAction&gt;) =&gt; Promise&lt;void&gt;'.
                    Type 'Promise&lt;void&gt;' provides no match for the signature '(dispatch: Dispatch&lt;AnyAction&gt;): Promise&lt;void&gt;'.
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YOMcD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YOMcD.png" alt="enter image description here"></a></p>
  
  <p><strong>Is it possible to replace the <code>any</code> type on the dispatch parameter in <code>mapDispatchToProps</code>?</strong></p>