title: How to make object type from an object keys in typescript?
body: <p>I have an js object with two keys, <code>foo</code> and <code>bar</code>.</p>
  <pre><code>const x = { foo: '', bar: '' }
  </code></pre>
  <p>Also I have <code>abc</code> function that take value (the value can be <code>foo</code> or <code>bar</code> only).</p>
  <pre><code>function abc(value: string) {
  
   const selected = x[value];
  }
  </code></pre>
  <p>currently, value is string type. but I want to have <code>foo</code> or <code>bar</code> (cause I have them in <code>x</code> object).
  I try to do with</p>
  <pre><code>  function abc(value: typeof x)
  </code></pre>
  <p>But typescript doesn't accept that.</p>
  <p>How can I change my code to make it work as I expected?</p>