Skip to content

Instantly share code, notes, and snippets.

@tswistak
Created January 16, 2019 10:24
Show Gist options
  • Save tswistak/092201ec4f99a705318e01653a1c4b87 to your computer and use it in GitHub Desktop.
Save tswistak/092201ec4f99a705318e01653a1c4b87 to your computer and use it in GitHub Desktop.
Avoiding any in TypeScript, listing 2
const dict: Record<string, number> = {};
dict.a = 1;
dict.b = 'a'; // ERROR: "a" is not assignable to type number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment