How do I type an object with known and unknown keys in TypeScript : <p>I am looking for a way to create TypeScript types for the following object that has two known keys and one unknown key that has a known type:</p>

<pre><code>interface ComboObject {
  known: boolean
  field: number
  [U: string]: string
}

const comboObject: ComboObject = {
  known: true
  field: 123
  unknownName: 'value'
}
</code></pre>

<p>That code does not work because TypeScript requires that all properties match the type of the given index signature.  However, I am not looking to use index signatures, I want to type a single field where I know its type but I do not know its name.</p>

<p>The only solution I have so far is to use index signatures and set up a union type of all possible types:</p>

<pre><code>interface ComboObject {
  [U: string]: boolean | number | string
}
</code></pre>

<p>But that has many drawbacks including allowing incorrect types on the known fields as well as allowing an arbitrary number of unknown keys.</p>

<p>Is there a better approach?  Could something with TypeScript 2.8 conditional types help?</p>
