title: Could I avoid Array's "Object is possibly 'undefined'" of Typescript Error
body: <p>I got an error of <code>error TS2532: Object is possibly 'undefined'.</code> in typescript compile with strictNullChecks mode.</p>
  
  <pre><code>interface Hoge {
      num?: number;
  }
  
  const hoge: Hoge[] = [{ num: 1 }];
  
  if (!!hoge &amp;&amp; hoge.length &gt; 0 &amp;&amp; !!hoge[0] &amp;&amp; !!hoge[0].num) {
      hoge[0].num.toString()
  }
  </code></pre>
  
  <p><a href="https://www.typescriptlang.org/play/#src=interface%20Hoge%20%7B%0D%0A%20%20%20%20num%3F%3A%20number%3B%0D%0A%7D%0D%0A%0D%0Aconst%20hoge%3A%20Hoge%5B%5D%20%3D%20%5B%7B%20num%3A%201%20%7D%5D%3B%0D%0A%0D%0Aif%20(!!hoge%20%26%26%20hoge.length%20%3E%200%20%26%26%20!!hoge%5B0%5D%20%26%26%20!!hoge%5B0%5D.num)%20%7B%0D%0A%20%20%20%20hoge%5B0%5D.num.toString()%0D%0A%7D%0D%0A" rel="nofollow noreferrer">playground</a> (please check <code>strictNullChecks</code>)</p>
  
  <p>However, I thought these condition have completely avoided <code>undefined</code> typed <code>hoge</code> already.</p>
  
  <p>I guess non-null assertion operator works well: <code>hoge[0].num!</code>, but I'm wondering if there are other type safed ways.</p>