Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save edezekiel/bc812a3cf13b7c1c25c0e87dc3fc826f to your computer and use it in GitHub Desktop.
Save edezekiel/bc812a3cf13b7c1c25c0e87dc3fc826f to your computer and use it in GitHub Desktop.
No error when assigning interface to Record<string, any> even without index signature
interface Hero { name: string; } // Missing the 'string' index signature
const hero: Hero = { hero: 'codey' };
const generic: Record<string, any> = hero; // No Error. Why? How?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment