title: How to declare a TypeScript interface with variable number of properties?
body: <p>This is a simple question, and I'm surprised that I can't find a clear answer to it anywhere. I'm making an API and I need to define an Interface that can have multiple (string) properties, but there's no set number of properties and no set names for them (but they all have to have string values). So all of the following objects would match the type:</p>
  <pre><code>{ slot: &quot;ten&quot; }
  
  { class: &quot;Luxury&quot;, base: &quot;never&quot;, city: &quot;Timbuktu&quot; }
  
  { slot: &quot;ten&quot;, class: &quot;Luxury&quot; }
  </code></pre>
  <p>I've thought of the following.</p>
  <pre><code>interface MyInterface {
      [key: string]: string;
  }
  </code></pre>
  <p>But to me, this says that the objects can have <em>only one</em> property (of varying name), rather than that they can have multiple properties (of varying names).</p>
  <p>What's the best way to do this? Note that I can't control what property names the code that calls my API will use. Callers can use whatever property names that they want.</p>