title: Redux action return type when using dispatch and getState
body: <p>I am struggling to figure out what the return type should be for my action. Everything works whilst I am using <code>any</code> but am trying to avoid using <code>any</code>.</p>
  
  <pre><code>export const saveValue = (value: number): any =&gt; {
      return (dispatch: Dispatch&lt;SaveValue&gt;, getState: () =&gt; State): void =&gt; {
          axios.post('www.exampleurl.com', value)
              .then((response) =&gt; {
                  const someValueFromState = getState().stateValue;
                  const payload = {...response, someValueFromState}
                  dispatch({ type: constants.SAVE_VALUE, payload });
              });
      };
  };
  </code></pre>
  
  <p>I had it working before when the action was not using <code>getState()</code> and it looked like this, where it returned <code>Dispatch&lt;SaveValue&gt;</code>:</p>
  
  <pre><code>export const saveValue = (value: number): Dispatch&lt;SaveValue&gt; =&gt; {
      return (dispatch: Dispatch&lt;SaveValue&gt;): void =&gt; {
          axios.post('www.exampleurl.com', value)
              .then((response) =&gt; {
                  dispatch({ type: constants.SAVE_VALUE, response });
              });
      };
  };
  </code></pre>
  
  <p>But once I added getState, I am not sure what to do anymore. I have tried to put the return value in a variable and can see the object I am creating is <code>const myAttempt: (dispatch: Dispatch&lt;SaveValue&gt;, getState: () =&gt; State) =&gt; void</code> but when I tried to use it as follows, it doesn't work:</p>
  
  <pre><code>export const saveValue = (value: number): (dispatch: Dispatch&lt;SaveValue&gt;, getState: () =&gt; StoreState) =&gt; void =&gt; {
      return (dispatch: Dispatch&lt;SaveValue&gt;, getState: () =&gt; State): void =&gt; {
          axios.post('www.exampleurl.com', value)
              .then((response) =&gt; {
                  const someValueFromState = getState().stateValue;
                  const payload = {...response, someValueFromState}
                  dispatch({ type: constants.SAVE_VALUE, payload });
              });
      };
  };
  </code></pre>
  
  <p>Doing this, I get an error: <code>A function whose declared type is neither 'void' nor 'any' must return a value.</code></p>
  
  <p>EDIT:</p>
  
  <p>Just to add, I cannot return <code>Dispatch&lt;SaveValue&gt;</code> as I was before, otherwise I get this error: <code>Type '(dispatch: Dispatch&lt;SaveValue&gt;, getState: () =&gt; State) =&gt; void' is not assignable to type 'Dispatch&lt;SaveValue&gt;'</code></p>