title: Set types on useState React Hook with TypeScript
body: <p>I'm migrating a React with TypeScript project to use hooks features (React v16.7.0-alpha), but I cannot figure out how to set typings of the destructured elements.</p>
  
  <p>Here is an example:</p>
  
  <pre><code>interface IUser {
    name: string;
  }
  ...
  const [user, setUser] = useState({name: 'Jon'});
  </code></pre>
  
  <p>I want to force <code>user</code> variable to be of type <code>IUser</code>. My only successful trial, is doing it in two phases: Typing, then initializing:</p>
  
  <pre><code>let user: IUser;
  let setUser: any;
  [user, setUser] = useState({name: 'Jon'});
  </code></pre>
  
  <p>But I'm sure there is a better way. Also, <code>setUser</code> should be initialized as a function that takes a <code>IUser</code> as input, and returns nothing.</p>
  
  <p>Also, worth noting that using <code>const [user, setUser] = useState({name: 'Jon'});</code> without any initialization works fine, but I would like to take advantage of TypeScript to force type checking on init, especially if it depends on some props.</p>
  
  <p>Thanks for your help.</p>