title: Access children of an object in TypeScript
body: <p>I am trying to access the children of an object in TypeScript.</p>
  
  <p>So object1 is a child of Object. When I console log Object (parent), I clearly see the property 'Children'. If I expand Children, I see Object1.</p>
  
  <p><a href="https://i.stack.imgur.com/DKQch.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DKQch.png" alt="enter image description here"></a></p>
  
  <p>Normally in JavaScript, I would do something like</p>
  
  <pre><code>var child = Object.children[0];
  </code></pre>
  
  <p>However, when I do that in TypeScript, it gives a syntax error saying</p>
  
  <blockquote>
    <p>error TS2339: Property 'children' does not exist on type 'DisplayObject'.</p>
  </blockquote>
  
  <p>Is there a different way to do it in TS?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>A sample code:</p>
  
  <pre><code>  this.game.world.children.forEach(function(child){
          var constructorString: string = child.constructor.toString();
          var className: string = constructorString.match(/\w+/g)[1];
          if(className=='AcheivmentButton'){
            for(var i=0; i&lt;child.children.length; i++)
              children.push(child.children[i]);
          }
        })
  </code></pre>