title: How to use createAsyncThunk from Redux Toolkit with TypeScript correctly?
body: <p>I want to create a Redux slice for the users inside the project I work on. I have <a href="https://codesandbox.io/s/young-glitter-ve35r?file=/src/MyButton.tsx" rel="nofollow noreferrer">this code sandbox</a> and I do not know why there is the following error on the <code>fetchAll</code> call in the <code>MyButton.tsx</code> file:</p>
  <blockquote>
  <p>fetchAll(arg: any): AsyncThunkAction&lt;unknown, any, {}&gt;</p>
  <p>Expected 1 arguments, but got 0.</p>
  <p>createAsyncThunk.d.ts(107, 118): An argument for 'arg' was not provided.</p>
  </blockquote>
  <p>I have similar code in the project I work on and it does not have this error. I expected this to work just as it does in other similar files.</p>
  <p>The relevant files from the sandbox:</p>
  <h1>MyButton.tsx</h1>
  <pre><code>import React from &quot;react&quot;;
  import { useDispatch } from &quot;react-redux&quot;;
  import { fetchAll } from &quot;./redux/usersSlice&quot;;
  
  export const MyButton = ({ children }: { children: any }) =&gt; {
    const dispatch = useDispatch();
  
    return (
      &lt;button
        onClick={() =&gt; {
          dispatch(fetchAll()); // I get an error on this fetchAll() call
        }}
      &gt;
        {children}
      &lt;/button&gt;
    );
  };
  </code></pre>
  <h1>The definition of fetchAll</h1>
  <pre><code>export const fetchAll = createAsyncThunk(
    &quot;users/fetchAll&quot;,
    async (_: any, thunkAPI) =&gt; {
      const users = await new Promise((resolve, reject) =&gt; {
        resolve([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]);
      });
  
      return users;
    }
  );
  </code></pre>
  <h1>Update 1</h1>
  <p>If I call <code>fetchAll(null)</code> instead of <code>fetchAll()</code>, it works well.</p>