title: Argument of type 'string | undefined' is not assignable to parameter of type '"untitled" | null | undefined'
body: <p>I can't understand something about TypeScript's type inference.  I thought this should be valid and wouldn't require me to specify the type of <code>T</code>:</p>
  
  <pre><code>export const deflt = &lt;T&gt;(val: (T | undefined | null), defaultVal: T): T =&gt; {
    if (val === undefined || val === null) {
      return defaultVal;
    }
    return val;
  }
  
  function maybeLabelName(name: string | undefined) {
    return deflt(name, 'untitled');
  }
  </code></pre>
  
  <p>The call to deflt fails with the following error:</p>
  
  <pre><code>Argument of type 'string | undefined' is not assignable to parameter of type '"untitled" | null | undefined'.
    Type 'string' is not assignable to type '"untitled" | null | undefined'. [2345]
  </code></pre>
  
  <p>I can fix it by changing the <code>deflt</code> call to one of the following:</p>
  
  <pre><code>// Option 1:
  return deflt&lt;string&gt;(name, 'untitled');
  
  // Option 2:
  const s: string = 'untitled';
  return deflt(name, s);
  </code></pre>
  
  <p>Shouldn't TypeScript infer the <code>string</code> type automatically?</p>