title: Typescript type string is not assignable to type keyof
body: <p>I have the following code:</p>
  
  <pre><code>const KeyboardEventKeys = {
    Escape: 'Escape',
    Enter: 'Enter',
    Tab: 'Tab'
  };
  
  type KeyboardEventKeys = keyof (typeof KeyboardEventKeys);
  
  function doSomething(key: KeyboardEventKeys) {}
  </code></pre>
  
  <p>When I'm passing to a function the value of one of the object properties it yells at me:</p>
  
  <pre><code>doSomething(KeyboardEventKeys.Enter);
  </code></pre>
  
  <p>One solution is to cast <code>as KeyboardEventKeys</code>, but it's a redundant solution. How can I do it without it?  </p>
  
  <p>I also don't want to add <code>doSomething(key: KeyboardEventKeys | string)</code> because I will lose the type guard.</p>