title: Typescript Issue - Typescript dosen't Infer object properties
body: <p>I have a trouble with Typescript
  I am trying to infer the properties of an Object dynamically.</p>
  <p>take a look at the below code</p>
  <pre><code>const Actions = {
      globalUI: {
          openModal: 'openModal'
      }
  }
  
  type Param = keyof typeof Actions;
  type T = &lt;T, K extends keyof T&gt;(action: T, key: K) =&gt; T[K];
  const fn = (param: Param) =&gt; {
  
      const action = mapper(Actions, param);
  
      return action
  }
  const mapper:T = (action, name) =&gt; {
      return action[name]
  }
  
  const action = fn('globalUI');
  </code></pre>
  <p><a href="https://i.stack.imgur.com/qWRId.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qWRId.png" alt="enter image description here" /></a></p>
  <p>as you can see Typescript can infer a global UI properties</p>
  <p>but When I put the additional property in the Actions Object
  <a href="https://i.stack.imgur.com/X4IF3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X4IF3.png" alt="enter image description here" /></a></p>
  <p>Typescript doesn't infer Object properties</p>
  <pre><code>const Actions = {
      globalUI: {
          openModal: 'openModal'
      },
      LP: {
          addDirectory: 'addDirectory'
      }
  }
  
  type Param = keyof typeof Actions;
  type T = &lt;T, K extends keyof T&gt;(action: T, key: K) =&gt; T[K];
  const fn = (param: Param) =&gt; {
  
      const action = mapper(Actions, param);
  
      return action
  }
  const mapper:T = (action, name) =&gt; {
      return action[name]
  }
  
  const action = fn('globalUI');
  </code></pre>
  <p><a href="https://i.stack.imgur.com/ROXQ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ROXQ8.png" alt="enter image description here" /></a></p>
  <p>How can I achieve it?
  please give any idea</p>