« Back to home

Typescript weirdness: function vs. => and "this"

Alright, I ran into a non-obvious problem with Typescript and want to share. I guess it can also be chalked up to “Javascript weirdness” but the second layer of Typescript confused me. I have basketball games and I want to create a quick dictionary of a team to all of their games. I wrote code like this: class Season { teamsToGames: { [teamName: string]: Array; } = {}; addGame(g : Game) { .…

Read more »