buskerudbyen / cycling-norway

3 stars 2 forks source link

Refactoring: Types #118

Closed michaeljohansen closed 4 months ago

michaeljohansen commented 4 months ago

The codebase is currently plain JavaScript, which means we have no type information. The frontend community has largely moved towards using TypeScript, a superset of JavaScript, which enables declaration of types and ensures types are correct. This prevents a whole class of bugs, and improves the ability of developer tools significantly.

The estimates on how many bugs TypeScript prevents varies a lot, but I was at JSConf Hawaii in 2019 where a talk from Airbnb found that 38% of bugs in a project were preventable with TypeScript alone. I'd say this is a high figure, but I wouldn't be surprised if around 20% of bugs are prevented in this codebase (which is still a very high figure, so worth it).

leonardehrenfried commented 4 months ago

I work exclusively with typed languages on the backend so I would welcome this. However, it's @Beck-berry who is going to do the work, so she has to be ok with it.

michaeljohansen commented 4 months ago

Beki and I had a pair coding session where we rewrote most of the code to TypeScript. 🚀 PR coming on Monday.