Created
January 16, 2019 10:24
-
-
Save tswistak/092201ec4f99a705318e01653a1c4b87 to your computer and use it in GitHub Desktop.
Avoiding any in TypeScript, listing 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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