title: How do I type the result of awaiting a thunk dispatch?
body: <p>I want to await the result of a thunk, which returns a string asynchronously. My problem is in the last line-- I can't figure out how to type <code>cityName</code> as <code>string</code>.</p>
  
  <blockquote>
    <p>// error, Type 'ThunkAction, AppState, undefined,
    any>' is not assignable to type 'string'.</p>
  </blockquote>
  
  <p>The code works as intended, I just unfortunately need to type <code>cityName</code> as <code>any</code></p>
  
  <pre><code>const getCity = (): Thunk&lt;Promise&lt;string&gt;&gt; =&gt; async (
    dispatch,
    getState
  ): Promise&lt;string&gt; =&gt; {
    // ...
    const city = await fetchCityApi(query);
    dispatch(setUserCity(city));
    return city;
  };
  
  export const getDataUsingCity = (): Thunk&lt;void&gt; =&gt; async dispatch =&gt; {
    const cityName: string = await dispatch(getCity());
  };
  </code></pre>
  
  <p>I am using a wrapper for Thunk that works great as long as my Thunks don't return a value:</p>
  
  <pre><code>export type Thunk&lt;R&gt; = ThunkAction&lt;R, AppState, undefined, any&gt;;
  </code></pre>