title: Typescript error got undefined with useState hook
body: <p>Im new to graphql so I decided to follow this <a href="https://medium.com/make-it-heady/part-2-building-full-stack-web-app-with-postgraphile-and-react-client-side-1c5085c5a182" rel="nofollow noreferrer">guide</a>.</p>
  <p>However I got an error when querying (step 7) :</p>
  <pre><code>Argument of type '({ __typename?: &quot;User&quot;; } &amp; Pick&lt;User, &quot;email&quot; | &quot;id&quot; | &quot;name&quot; | &quot;createdAt&quot;&gt;)[]' is not assignable to parameter of type '(prevState: undefined) =&gt; undefined'.
    Type '({ __typename?: &quot;User&quot;; } &amp; Pick&lt;User, &quot;email&quot; | &quot;id&quot; | &quot;name&quot; | &quot;createdAt&quot;&gt;)[]' provides no match for the signature '(prevState: undefined): undefined'.  TS2345
  
      37 |       if (data &amp;&amp; data.allUsers) {
      38 |         if (data &amp;&amp; data.allUsers &amp;&amp; data.allUsers.nodes) {
    &gt; 39 |           setUsers(data.allUsers.nodes);
         |                    ^
      40 |         }
      41 |       }
      42 |     }
  
  </code></pre>
  <p>Here is the component:</p>
  <pre class="lang-js prettyprint-override"><code>import React, { useState, useEffect } from 'react'
  import { useGetUsers } from '../utils/services'
  import { User } from '../generated/graphql'
  
  const Users: React.FC = () =&gt; {
      const [users, setUsers] = useState()
      const { data, error, loading } = useGetUsers()
      
      useEffect(() =&gt; {
          if (data) {
              if (data &amp;&amp; data.allUsers &amp;&amp; data.allUsers.nodes) {
                  setUsers(data.allUsers.nodes)
              }
          }
          if (error) {
              console.log(error)
          }
          if (loading) {
              console.log(loading)
          }
      }, [data, error, loading])
  
      return (
          &lt;&gt;
              &lt;h2&gt;Hello users,&lt;/h2&gt;
              {users &amp;&amp;
                  users.length &gt; 0 &amp;&amp;
                  users.map((user: User, index: number) =&gt; (
                      &lt;p key={`user_${index}`}&gt;
                          {user.name}{' '}
                      &lt;/p&gt;
                  ))}
          &lt;/&gt;
      )
  }
  
  export default Users
  </code></pre>
  <p>However it works when I use</p>
  <pre class="lang-js prettyprint-override"><code>data.allUsers.nodes
  </code></pre>
  <p>Like this :</p>
  <pre class="lang-js prettyprint-override"><code>{data &amp;&amp; data.allUsers ? (
          data.allUsers.nodes &amp;&amp;
          data.allUsers.nodes.length &gt; 0 &amp;&amp;
          data.allUsers.nodes.map((user: User, index: number) =&gt; (
            &lt;p key={`user_${index}`}&gt;{user.name}&lt;/p&gt;
          ))
        ) : (
          &lt;React.Fragment /&gt;
        )}
  </code></pre>
  <p>And of course I've removed <code>setUsers</code> in the <code>useEffect()</code> hooks.</p>
  <p>I notice that I had to set strict to false in my <code>.tsconfig.json</code> file.</p>
  <p>I would like to know why I m not able to use the setUsers hooks? Why I got that error and how to solve it?</p>
  <p>Thank you!</p>