title: Typescript how do I dynamically use type of object property
body: <p>Say I have some code like this:</p>
  <pre class="lang-js prettyprint-override"><code>type Action = {
      type: string;
      data: /* need help here */;
  };
  
  // data is a string here
  const action1: Action = {
      type: 'foo',
      data: 'bar'
  };
  
  // data is an object here
  const action2: Action = {
      type: 'complex',
      data: {
          first: 'John',
          last: 'Doe'
      }
  };
  
  // data is not defined here
  const action3: Action = {
      type: 'undef'
  };
  
  // and so on, the point is data can be anything 
  </code></pre>
  <p>I want to have the type of <code>data</code> be whatever the type of <code>data</code> is on the object so that the previous code example will not give me any compiler errors. <strong>I don't want to use <code>any</code></strong> because I want to have my editor's intellisense help with the type when I type. Is there a way in Typescript to do what I'm trying to do?</p>