title: Is there any way to specify the type in Typescript of an object where the leaves are all one type but the key names are flexible?
body: <p>Couldn't think of an easy way to phrase the title, an example should be clearer:</p>
  <p>Say I have an interface:</p>
  <pre><code>interface Vehicle {
    color: string;
    year: number;
  }
  </code></pre>
  <p>Now I have two objects:</p>
  <pre><code>const FIRST = {
    cars: {
      a: {color: &quot;red&quot;, year: &quot;1980&quot;},
      b: {color: &quot;blue&quot;, year: &quot;1991&quot;}
    },
    trucks: {
      red_trucks: {
        c: {color: &quot;red&quot;, year: &quot;1990&quot;}
      }
    }
  }
  
  const SECOND = {
    collection: {
      new_cars: {
        x: {color: &quot;green&quot;, year: &quot;2015&quot;},
        y: {color: &quot;blue&quot;, year: &quot;2019&quot;}
      }
    }
  }
  </code></pre>
  <p>The names and structure of the keys in the objects are different - <code>FIRST</code> has <code>cars-&gt;a, b</code> and <code>trucks-&gt;red_trucks- c</code> while <code>SECOND</code> just has <code>collection-&gt;new_cars-&gt;x, y</code>. And let's say there will be many objects like this, all with different key names.</p>
  <p>But they're kind of similar, still, in that really the object is just storing <code>Vehicle</code>s, but it happens to nest some objects to do that.</p>
  <p>Is there any way to specify a type here that would be something like &quot;We don't know the keys but each key's value is either another object with more keys or a <code>Vehicle</code>&quot;? Some kind of recursive type?</p>