title: Typescript: record of KeyType -> value types
body: <p>I need to create a Typescript <code>Record</code> with the keys defined in an independent type and specific types for each value.</p>
  <p>The keys are defined as follows:</p>
  <pre><code>// Keys must be available/iterable at runtime
  const keys = ['a', 'b', 'c'] as const
  export type Key = typeof keys[number]
  </code></pre>
  <p>Now I see two options, both flawed.</p>
  <p>Option 1: repeat the keys and define the value types explicitly, as needed. Flaw: <code>Structure</code> isn't actually based on <code>Key</code> and they might deviate.</p>
  <pre><code>export type Structure1 = {
    a: number
    b: boolean
    c: string
  }
  </code></pre>
  <p>Option 2: define a record from <code>Key</code> and lose the specific type information on the values:</p>
  <pre><code>export type Structure2 = Record&lt;Key, number | boolean | string&gt;
  </code></pre>
  <p>Is there a third option for a <code>Structure3</code> that uses <code>Key</code> as the key type <em>and</em> an explicit value type per key?</p>