title: Redux Thunk TS return type definition
body: <p>I'm trying to define the returned type of my Redux Thunk function.</p>
  <p>Basically I'm dispatching an action that will eventually return a string.</p>
  <p>So I wrote:</p>
  <pre><code>export type AppThunk = ThunkAction&lt;Promise&lt;string&gt;, IState, unknown, Action&gt;;
  
  export const getServiceUrl = (url: string): AppThunk =&gt; {
    return async (dispatch) =&gt; {
      dispatch(startLoading(retrievingData));
      try {
        const { serviceUrl } = await getJson(url);
        return serviceUrl;
      } catch (error) {
        dispatch(stopLoading());
      }
    };
  };
  </code></pre>
  <p>Inside my component I have:</p>
  <pre><code>const serviceUrl = await dispatch(
    getServiceUrl(
      `/api/microservice/email`
    )
  );
  
  if (serviceUrl) {
    window.location.assign(redirectUrl);
  }
  </code></pre>
  <p>I'm constantly getting <code>TS2345: Argument of type ‘AppThunk’ is not assignable to parameter of type ‘string | URL</code>.</p>
  <p>But I don't understand why.</p>
  <p>How can I declare the return type of my thunk function?</p>