title: Typescript: validate that keys of Type objects are only one of K and single key:value pair
body: <p>I have the following code, which gives me <code>ts(1337)</code> error:</p>
  <pre class="lang-js prettyprint-override"><code>type Options = 'option1' | 'option2' | 'option3'
  
  type ComplexValue = { [key: Options]: string } // ts error 1337
  </code></pre>
  <p>what I want to achieve here is that keys of <code>ComplexValue</code> objects can be only one of <code>Options</code>.</p>
  <p>if I try to fix and define it differently by one of the below options:</p>
  <pre class="lang-js prettyprint-override"><code>type ComplexValue = { [K in Options]: string }
  
  // or simply
  
  type ComplexValue = Record&lt;ServerFilterOperator, string&gt;
  </code></pre>
  <p>and then trying to write something like this</p>
  <pre class="lang-js prettyprint-override"><code>const something: ComplexValue = { option1: 'ziv' }
  </code></pre>
  <p>then I get the below error
  <code>Type '{ [x: string]: string; }' is missing the following properties from type 'ComplexValue': option2, option3.ts(2740)</code></p>
  <p>A workaround I can apply is adding <code>?</code> to the definition <code>type ComplexValue = { [key in Options]?: string }</code> - this will apply that all keys are optional. But I actually wants to validate only single <code>key:value</code> are passed.</p>
  <p>What is the proper way validate that keys of <code>ComplexValue</code> objects can be only one of <code>Options</code> and only one <code>key:value</code> pair is on the object?</p>
  <p><a href="https://www.typescriptlang.org/play?#code/C4TwDgpgBA8mwEsD2A7AzlAvFA5E+yKAjDlAD676KoBMpFeBqAzDgFBuiRQDCSAtmAA2EAB4A1AIZCArtGwBvKAG0A1hBAAuWE3QBdbWmAAnBCgDmUAL4cAxqiNQ0AiMAAWZ89r6CRE6XJYUEpUhETaOABeCABupFZAA" rel="nofollow noreferrer">link to TS playground is here</a></p>