title: check if object has key in Typescript and use that key
body: <p>I have the following code:</p>
  <pre class="lang-js prettyprint-override"><code>let show = {
      createTag: false,
      updateFeature: false,
      createFeatureGroup: false,
      deleteFeature: false,
      deleteCycle: false,
  };
  </code></pre>
  <p>And I'm getting a value from the querystring that I want to match agains the keys of show.</p>
  <p>The following code works ok, but I want a way to let Typescrpt infer it and avoid having to issue the cast:</p>
  <pre class="lang-js prettyprint-override"><code>const showDialog = $page.query.get('show') || '';
  
  if (showDialog &amp;&amp; showDialog in show) {
      // I want to get rid of the &quot;&lt;keyof typeof show&gt;&quot; cast
      show[&lt;keyof typeof show&gt;showDialog] = true; 
  }
  </code></pre>
  <p>I though that just issueing <code>showDialog in show</code> typescript would know that inside that <code>if</code> showDialog is a key of <code>show</code>, but it doesn't seem to be the case.</p>