title: how to limit keys of an object to a list of set strings in typescript
body: <p>I have an api that can return one of the following:</p>
  
  <p><code>{ fill: 'string'}</code> or <code>{stroke: 'string'}</code> or <code>{effect: 'string'}</code></p>
  
  <p>I have the following type for the key:</p>
  
  <pre><code>type StyleKeyType =
    | 'fill'
    | 'stroke'
    | 'effect';
  </code></pre>
  
  <p>and I'd like to create a type for the object. I tried:</p>
  
  <pre><code>type StylesObject = { [K in StyleKeyType]?: string };
  </code></pre>
  
  <p>but this fails as it thinks that <code>{}</code> is valid where in my case it is not.</p>
  
  <p>Is there a way to generate this type without manually spelling out each of the possible object types?</p>