'Property 'id' of type 'number' is not assignable to 'string' index type 'string'

Why this definition is all right

interface ErrorContainerNum2 { 
  id: string;
  [prop: number]: number;
}

and this definition vscode complaints "Property 'id' of type 'number' is not assignable to 'string' index type 'string'"?

interface ErrorContainerNum3 { 
  id: number;
  [prop: string]: string;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source