title: Preserve Type when using Object.entries
body: <p>I'm fairly new to TypeScript, so I'm in the process of upgrading my old projects to utilize it.</p>
  
  <p>However, I'm not sure how to preserve the correct Type when calling Object.entries on some data.</p>
  
  <p><a href="https://codesandbox.io/s/cocky-gould-telcz?file=/src/App.tsx" rel="noreferrer">CodeSandbox example</a></p>
  
  <p>As an example:</p>
  
  <p><strong>Level.tsx:</strong></p>
  
  <pre><code>  const UnpassableTileComponents = useMemo(() =&gt; 
      Object.entries(levelData[`level_${gameLevel}`].tiles.unpassable_tiles).map(([tileType, tiles]) =&gt; (
        tiles.map(([leftPos, topPos], index) =&gt; (
          &lt;UnpassableTile
            key={`${tileType}_${index}`}
            leftPos={leftPos * 40}
            topPos={topPos * 40}
            tileType={tileType}
          /&gt;
        ))
      )
    ).flat(), [gameLevel])
  </code></pre>
  
  <p><strong>levelData.tsx:</strong></p>
  
  <pre><code>import levelJSON from "./levelJSON.json";
  
  interface ILevelJSON {
    [key: string]: Level;
  }
  
  interface Level {
    tiles: Tiles;
  }
  
  interface Tiles {
    unpassable_tiles: UnpassableTiles;
  }
  
  interface UnpassableTiles {
    rock: Array&lt;number[]&gt;;
    tree: Array&lt;number[]&gt;;
  }
  
  export default levelJSON as ILevelJSON;
  </code></pre>
  
  <p><strong>levelJSON.json:</strong></p>
  
  <pre><code>{
    "level_1": {
      "tiles": {
        "unpassable_tiles": {
          "rock": [[0, 0]],
          "tree": [[2, 0]]
        }
      }
    },
    "level_2": {
      "tiles": {
        "unpassable_tiles": {
          "rock": [[]],
          "tree": [[]]
        }
      }
    }
  }
  </code></pre>
  
  <p>In the case of the above, tiles represents an Array of arrays, each with two numbers.
  Therefore, [leftPos, topPos] should both be typed as number. However, in Level.tsx, they have properties of any. I could get my desired result with the following:</p>
  
  <pre><code>  const UnpassableTileComponents = useMemo(() =&gt; 
      Object.entries(levelData[`level_${gameLevel}`].tiles.unpassable_tiles).map(([tileType, tiles]) =&gt; (
        tiles.map(([leftPos, topPos] : number[], index: number) =&gt; (
          &lt;UnpassableTile
            key={`${tileType}_${index}`}
            leftPos={leftPos * 40}
            topPos={topPos * 40}
            tileType={tileType}
          /&gt;
        ))
  </code></pre>
  
  <p>But shouldn't number[] be inferred anyways?</p>
  
  <p>Any advice would be appreciated.</p>