title: Is there a way for typescript to type using broad keys of a defined object in typescript?
body: <pre><code>const obj: {[key: string]: string} = {foo: 'x', bar: 'y'};
  
  type ObjType = keyof typeof obj;
  </code></pre>
  <p>Without modifying the type of <code>obj</code>, how can I make <code>ObjType</code> accept only &quot;foo&quot; or &quot;bar&quot; and not any string ?</p>