title: TypeScript: get the type of a nested object
body: <p>I know that this question may have been answered elsewhere but in case it wasn't, can someone help me get the type of a nested object? We're talking about an object that has multiple other object but all of them look pretty much the same.</p>
  <pre><code>const VALUES = {
      currentStreak: {
        display: &quot;Current streak&quot;,
        value: currentStreak,
      },
      longestStreak: {
        display: &quot;Longest streak&quot;,
        value: longestStreak,
      },
      contributionsThisYear: {
        display: &quot;Contributions this year&quot;,
        value: contributionsThisYear,
      },
      totalContributions: {
        display: &quot;Total contributions&quot;,
        value: totalContributions,
      },
      currentCompany: {
        display: &quot;Working at&quot;,
        value: currentCompany,
      },
  }
  </code></pre>
  <p>This would be the object and this is what I've got. It works well for the main keys but I want to have the keys of each object typed as well.</p>
  <pre><code>export type Something = {
    [key in keyof typeof VALUES]: { [key: string]: string | number };
  };
  </code></pre>
  <p>How do I get the second part right? So that each object has <code>display</code> and <code>value</code> with <code>value</code> being a number or a string.</p>
  <p>Sorry if this is a repeat! I'm hoping to understand this once and for all.</p>