title: Break loop over TypeScript object properties
body: <p>I would like to iterate over object properties with TypeScript. But I would like to stop as soon as a specific object has been found.</p>
  
  <p>Something like:</p>
  
  <pre><code>function hasElement() {
      let obj = {
          a: 'a',
          b: 'b',
          c: 'c'
      }
      let found = false;
      for (let i = 0; i &lt; Object.keys(this.obj).length &amp;&amp; !found; i++) {
          let prop = obj[i];
          found = prop === 'a';
      }
      return found;
  }
  console.log(hasElement());
  </code></pre>
  
  <p>But <code>obj[i]</code> doesn't work because the key is not a number.
  Of course I could use <code>break</code> or jump to labels but it is ugly in my opinion as I would rather like to specify the loop condition in the first place.</p>