Originally published at Medium on Apr 17, 2019
But yeah, TypeScript. It’s supposed to make your code more robust, avoid bugs, blah blah blah. I’m a bit skeptical about all those blanket statements. And I’m not alone on that, as Eric Elliott mentions on The TypeScript Tax:
“Type safety doesn’t seem to make a big difference. TypeScript proponents frequently talk about the benefits of type safety, but there is little evidence that type safety makes a big difference in production bug density.”
By now you might be thinking “but wait, wasn’t this post titled Moving to Typescript?”. Yeah, despite all this ranting I moved the game code to TypeScript, and I don’t regret it.
You see, Phaser 3 doesn’t have the best documentation. It’s quite cumbersome to find something there, and most of the time I find it really hard to see how everything is connected. Plus, Phaser itself does not make things too easy for the developer(like functions with a lot of parameters, instead of using an object with keys which makes the code much clearer).
It’s not all nice and good, the truth is that Phaser and TypeScript don’t work that well together, there is even less documentation, and at the time there are no Phaser types in DefinitelyTyped (so you need to manually add them to your project, and remember to update them if you upgrade the Phaser version). But overall, it’s totally worth it.
Does this mean I want to use TypeScript in all my projects now? Hell no. If you are using a simpler framework with good documentation, I don’t think it adds as much. But for Phaser, TypeScript has saved my sanity.
I haven’t been posting on the development diary lately, but this doesn’t mean I haven’t been working on the game! If you are curious about the progress, that’s how it looks so far:
Graphics and animations are not final, but they give a guideline about how it’s going to look. I’m pretty happy!