title: Redux Thunk with Typescript
body: <p>I am learning Typescript and I am trying to implement a simple React/Redux app. When I use sync actions it works fine, but the problems are with the async action. I am following the official redux tutorial.</p>
  
  <p>First I declare the state for the session</p>
  
  <pre><code>export interface UserSessionState {
    loggedIn: boolean;
  }
  </code></pre>
  
  <p>Then I declare the interface for the action</p>
  
  <pre><code>interface UpdateSessionAction {
    type: 'USER_LOGIN';
    payload: boolean;
  }
  </code></pre>
  
  <p>I export them with Union Types</p>
  
  <p><code>export type UserActionTypes = UpdateSessionAction;</code></p>
  
  <p>Then I have the actual Action</p>
  
  <pre><code>
  export function updateSession(loggedIn: UserSessionState) {
    return {
      type: 'USER_LOGIN',
      payload: loggedIn,
    };
  }
  </code></pre>
  
  <p>I have a fake api call </p>
  
  <pre><code>function api() {
    return Promise.resolve(true);
  }
  </code></pre>
  
  <p>And finally the login </p>
  
  <pre><code>export const userLogin = (): ThunkAction&lt;
    void,
    {},
    {},
    AnyAction
  &gt; =&gt; async (dispatch: ThunkDispatch&lt;{}, {}, AnyAction&gt;) =&gt; {
    const res = await api();
    dispatch(updateSession({ loggedIn: res }));
  };
  </code></pre>
  
  <p>In the reducer I simply initialize the state </p>
  
  <p><code>initialState: UserSessionState = {loggedIn: false}</code></p>
  
  <p>Then  I do the normal redux stuff for the reducer.</p>
  
  <p>Finally in my store I call the initial action for checking the state</p>
  
  <pre><code>store.dispatch(userLogin());
  </code></pre>
  
  <p>I keep getting this error:</p>
  
  <pre><code>Argument of type 'ThunkAction&lt;Promise&lt;void&gt;, {}, {}, AnyAction&gt;' is not assignable to parameter of type 'AnyAction'.
    Property 'type' is missing in type 'ThunkAction&lt;Promise&lt;void&gt;, {}, {}, AnyAction&gt;' but required in type 'AnyAction'.
  </code></pre>
  
  <p>I am missing a <code>type</code> but I have no idea what I do wrong. </p>