title: The type of dispatch in typescript
body: <p>Since I imagine in typescript we should avoid as much as possible using 'any' types I am rewriting all the anys a bit to transform them into more precise types but I am facing a problem when I try to change the type 'any' of the dispatch function of react redux. I don't know what to replace it with?</p>
  <p><strong>themeActions.ts :</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export const SWITCH_THEME: string = "SWITCH_THEME";
  
  export const switchTheme = (theme: string) =&gt; {
  
      return (dispatch: any) =&gt; {
          
          dispatch({ type: SWITCH_THEME, theme: theme })
          localStorage.setItem('theme', theme);
  
      }
  
  }</code></pre>
  </div>
  </div>
  </p>
  <p><strong>themeReducer.ts :</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import {SWITCH_THEME} from './themeActions';
  
  const initialState = {
      theme: localStorage.getItem('theme') === 'dark' ? 'dark' : 'light'
  }
  
  const themeReducer = (state = initialState, action: {type: string, theme: string}) =&gt; {
      switch (action.type) {
          case SWITCH_THEME:
              return {
                  ...state,
                  theme: action.theme
              }
              default:
                  return state
      }
  }
  
  export default themeReducer;</code></pre>
  </div>
  </div>
  </p>