Skip to content

Instantly share code, notes, and snippets.

@edezekiel
Last active September 8, 2023 03:10
Show Gist options
  • Save edezekiel/1d566bae9ca4c48de90ae22a5d1c1d95 to your computer and use it in GitHub Desktop.
Save edezekiel/1d566bae9ca4c48de90ae22a5d1c1d95 to your computer and use it in GitHub Desktop.
Demonstrating an error when you assign a string interface to a number index signature
interface Hero { name: string; }
const hero: Hero = { name: 'codey' };
const generic: { [key: number]: any } = hero; // Error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment