title: What is the TypeScript equivalent of using the bracket and variable which is a string to access an object property?
body: <p>An interviewer asked me the TypeScript way of doing this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const foo = { bar: 33, wah: 66 };
  
  console.log(foo.bar);   // 33
  console.log(foo.wah);   // 66
  
  
  let someName = "bar";
  console.log(foo[someName]);    //33
  
  someName = "wah";
  console.log(foo[someName]);    // 66</code></pre>
  </div>
  </div>
  </p>
  <p>I searched for the Internet for 10 minutes (which the interviewer allowed) and I found 500 or 1000 word writings and I still don't know how it is done, by seeing an 1 line or 2 line example.  <strong>For the JavaScript code that can use a string to access the property <code>bar</code> and <code>wah</code>, what is the TypeScript equivalent way of doing it?  Can somebody give a few lines of TypeScript code that can actually run and print out <code>33</code> and <code>66</code> like the JS code above, but in a TypeScript Playground or something similar to a JSFiddle?</strong></p>