title: Redux + TypeScript + typesafe-actions: error with createReducer/handleAction, Argument 1 is invalid
body: <p>I followed the tutorial on <a href="https://github.com/piotrwitek/typesafe-actions" rel="nofollow noreferrer">typesafe-actions</a> to create the simplest possible TypeScript/Redux project, however I can't get it working. I keep getting the error,</p>
  <p><code>Error: Argument 1 is invalid, it should be an action-creator instance from &quot;typesafe-actions&quot; or action type of type: string | symbol</code></p>
  <p>when I try to visit the page (Typescript is happy though, code transpiles ok)</p>
  <p>Here's my <strong>reducer.ts</strong> (Single reducer, should just overwrite the store with newData). This appears to be where the error is originating from, the second argument to <code>handleAction</code></p>
  <pre class="lang-js prettyprint-override"><code>import { setData } from &quot;actions&quot;;
  import { createReducer } from &quot;typesafe-actions&quot;;
  
  const dataReducer = createReducer({}).handleAction(
    setData,
    (state, action) =&gt; action.payload.newData
  );
  
  export default dataReducer;
  </code></pre>
  <p>Here's the <strong>actions.js</strong> file (I've tried using both <code>action</code> and <code>createAction</code>, no difference):</p>
  <pre class="lang-js prettyprint-override"><code>import { action, createAction } from &quot;typesafe-actions&quot;;
  import { SET_DATA } from &quot;constants&quot;;
  
  export const setData = (newData: string) =&gt; action(SET_DATA, { newData });
  </code></pre>
  <p><strong>constants.ts</strong> is a simple one-liner,
  <code>export const SET_DATA = &quot;SET_DATA&quot;;</code></p>
  <p>As per the tutorial, I'm trying to use the fancy <a href="https://github.com/piotrwitek/typesafe-actions#using-createreducer-api-with-type-free-syntax" rel="nofollow noreferrer">&quot;type-free&quot; syntax</a> in my Reducer code, so I also have a <code>types.d.ts</code> file</p>
  <pre class="lang-js prettyprint-override"><code>// types.d.ts
  import { StateType, ActionType } from &quot;typesafe-actions&quot;;
  
  export type RootAction = ActionType&lt;typeof import(&quot;./actions&quot;).default&gt;;
  
  declare module &quot;typesafe-actions&quot; {
    interface Types {
      RootAction: RootAction;
    }
  }
  </code></pre>
  <p>As far as I can tell, this should work for a very simple example. What am I doing wrong ere?</p>
  <p>Versions FYI:</p>
  <pre><code>&quot;react&quot;: &quot;^16.13.1&quot;,
  &quot;redux&quot;: &quot;^4.0.5&quot;,
  &quot;react-redux&quot;: &quot;^7.2.1&quot;,
  &quot;typescript&quot;: &quot;~3.7.2&quot;
  &quot;typesafe-actions&quot;: &quot;^5.1.0&quot;
  </code></pre>