title: Typescript function return type null if parameter null
body: <p>I want to let Typescript know that if the dbUser parameter passed to the function is not null, then that the result will not be null for sure.</p>
  
  <pre><code>type GetUser = (dbUser: DbUser | null) =&gt; GqlUser | null; 
  const getUser: GetUser = (dbUser) =&gt; {
    if(!dbUser) return null;
    return ... //gql user
  };
  
  const dbUser = { ... some fields} //not null for sure
  getUser(dbUser) //here I want typescript to know that the result will not be null
  </code></pre>
  
  <p>Basically, I know for sure that if dbUser parameter is not null, the result won't be either. How can I define the function in such a way?
  Currently, when I call the getUser function with non-null parameter, it still says that the result could be null, which I know for sure can't.</p>