title: Typescript Argument of type never[] is not assignable to parameter of type SetStateAction<never[]>
body: <p>I have a typescript code that assembles the steps of a form and it is giving me an error at build time, this is the function and it's giving me an error on the line:</p>
  <p>setVisitedForms((seenForms) =&gt; [...seenForms, currentIndex].sort((x, y) =&gt; x - y));</p>
  <pre><code>  const push = useCallback(
      (form = nextForm) =&gt; {
        if(!!currentForm) {
          const currentIndex = forms.indexOf(currentForm);
          if (currentIndex &gt;= 0) {
            setVisitedForms((seenForms) =&gt; [...seenForms, currentIndex].sort((x, y) =&gt; x - y));
          }
          history.push(`${baseurl}${form}`);
        }
      },
      [baseurl, history, nextForm, currentForm, forms, setVisitedForms]
    );
  </code></pre>
  <p><strong>This is the error that appears on the console. Does anyone know what I'm doing wrong?</strong></p>
  <pre><code>Argument of type '(seenForms: never[]) =&gt; number[]' is not assignable to parameter of type 'SetStateAction&lt;never[]&gt;'.
  </code></pre>