title: Nested advanced types, inferring that type is key of another object?
body: <p>I have a datastructure like this:</p>
  
  <pre><code>const VALUES = {
      val1: {...},
      val2: {...},
      val3: {...}
  };
  
  const DATA = [
      {
          name: "name1",
          value: "val1" // The value here, is a KEY (not a value) in the "VALUES" object.
      },
      {
          name: "name2",
          value: "val2"
      }
  ];
  
  
  type DataType = typeof DATA[number];/*{
      name: string;
      value: string; // I want this to be inferred as "typeof keyof VALUES"
  }*/
  </code></pre>
  
  <p>So my question is; is there a way to hint to TypeScript that <code>value</code> in <code>type DataType</code> should have the type <code>typeof keyof VALUES</code> (instead of <code>string</code>) without having to explicitly creating the type? Something like this perhaps:</p>
  
  <pre><code>const DATA = [
      {
          name: "name1",
          value: (keyof VALUES).val1
      },
      {
          name: "name2",
          value: (keyof VALUES).val2
      }
  ];
  </code></pre>