title: Typescript access dynamic property with [' '] syntax
body: <pre><code>export class Foo{
   someproperty: string;
  }
  </code></pre>
  
  <p>I am trying to understand why, when trying to access dynamic object property I can do the following as I saw on one of the answers here:</p>
  
  <pre><code>let fooObj: foo = someObj['someproperty']; 
  </code></pre>
  
  <p>but by doing this, I get an error.</p>
  
  <pre><code>let fooObj: foo = someObj.someproperty;
  </code></pre>
  
  <p>I am trying to understand, why the first method works for accessing/assigning to dynamic objects.</p>
  
  <p>Error:</p>
  
  <p><code>"someproperty does not exist on type"</code></p>
  
  <p>Question asked before here, answer by Angelo R is the one I am interested in.</p>
  
  <p><a href="https://stackoverflow.com/questions/12710905/how-do-i-dynamically-assign-properties-to-an-object-in-typescript">question</a></p>