title: TypeScript Property does not exist on type typeof enum, after checking that it definitely exists
body: <p>In the example below, a character can perform several actions, however, we only have verbs for some of the actions.</p>
  <p>We check to see that if verb is present before returning it.</p>
  <p>TypeScript won't accept that the verb exists, even after we have checked for it in the Enum.</p>
  <pre><code>type Action =
  | 'WALK'
  | 'RUN'
  | 'SLEEP'
  | 'SWIM';
  
  enum Verbs {
    'WALK' = 'walking',
    'RUN' = 'running',
    'SWIM' = 'swimming',
  }
  
  const getVerb = (character: string, action: Action): string =&gt; {
    if (action in Verbs) {
      // Property 'SLEEP' does not exist on type 'typeof Verbs'.ts(7053) ─┐
      const  verb = Verbs[action]; // &lt;───────────────────────────────────┘
      return `${character} is ${verb}`;
    }
    return `${character} is doing something weird`;
  }
  </code></pre>
  <p>Example codesandbox:
  <a href="https://codesandbox.io/s/nostalgic-grass-7vrpt?file=/src/index.ts" rel="nofollow noreferrer">https://codesandbox.io/s/nostalgic-grass-7vrpt?file=/src/index.ts</a></p>
  <p>I've worked around it by creating a <code>Partial</code> <code>Record</code> keyed with <code>Action</code>, but it would be good to understand why it won't work with an <code>Enum</code></p>
  <pre><code>const verbs: Partial&lt;Record&lt;Action, string&gt;&gt; = {
    'WALK': 'walking',
    'RUN': 'running',
    'SWIM': 'swimming',
  };
  const getVerb = (character: string, action: Action): string =&gt; {
    if (action in verbs) {
      return `${character} is ${verbs[action]}`; // Works 
    }
    return `${character} is doing something weird`;
  };
  </code></pre>