One of the key benefits of TypeScript includes debugging at compile time instead of runtime.
It encourages a more declarative style of programming and by defining types it is easier to spot when something goes wrong and get immediate feedback about it.
So when would you want to use TypeScript in your projects?
When applications grow in size and the code base is getting bigger and bigger it has long been a common problem that things tend to get messy and end up becoming “spaghetti code”.
This worked out pretty well and still does and these design patterns are widely used to building enterprise applications today.
What TypeScript does is bringing extra flavour to the mix to get more maintainable code by “cleaning up” the application.
TypeScript is commonly used together with Angular 2 and that is how it really started to grow in popularity. The beauty of this is that it can be used with any framework or library such as i.e. React.
In fact when I first started out using TypeScript I did so in Angular 2 and omitted it in React. Today I prefer to use it in most react apps that I create.
It forces you to think a step further and really care about what and how you declare things like variables and functions etc.
It is really up to you to make a decision when you feel it’s time to add an extra layer to your coding. As for most things in this world, it should come naturally to you.
If you consider yourself someone of this audience, feel free to comment on the thread below, I’d love to hear your story!