title: typescript: question mark vs type union with undefined
body: <p>When specifying a member with a question mark at the end of it's name, the type signature automatically gets extended to include <code>undefined</code>. It's okay to create an instance without this member:</p>
  
  <pre><code>interface Option{
      val? : number; // hover over val and it tells you that the type is number|undefined
  }
  
  let o: Option = {};
  </code></pre>
  
  <p>The inferred type of val is <code>number|undefined</code>. So far I thought that this was the only effect of the question mark. But manually annotating the type union does not have the same effect:</p>
  
  <pre><code>interface Union{
      val : number|undefined;
  }
  
  let u: Union = {}; // compiler complains about missing member val
  </code></pre>
  
  <p>Why is the second code sample incorrect?</p>