This is an excerpt from my recently published and free book, Yet Another TypeScript Book. It’s hosted by the good folks at Gitbook here: https://pagalvin.gitbooks.io/yet-another-typescript-book/content/
The introduction to the book is your typical book intro and starts to make the case for why TypeScript is worth your time learning.
Here’s the excerpt:
For starters, at least one major framework, Angular 2+, pushes you hard into using TypeScript. If you work at an Angular shop, you have a strong practical reason to learn it. Other frameworks provide TypeScript-friendly features or vice-versa. For instance, TypeScript provides first-class support to React developers via smart JSX intellisense.
Some people might characterize “learn it because you need it for future dev work” as a “negative externality” and not exactly popular. That would be fair. But consider the fact that many pure JS library authors have worked hard to provide TypeScript-friendly interfaces. Here’s the DefinitelyTyped github project:
Check it out today and see how much it’s grown since March 2017.
TypeScript’s growing popularity answers the “Why TypeScript” question in part. A lot of us aren’t swayed by popularity, however. I’m sympathetic to that point of view.
I came to TypeScript after spending about three or four years building solutions that contained minor to major bits of client-side code. I used jQuery for DOM manipulation and async work and lots of straight JS logic. I struggled with all the usual things at first, like closures or how to test for
These two points combine to make working with TypeScript a truly joyful experience. Closure complexities recede. It’s more difficult to accidentally assign strings to numbers. Refactoring isn’t as difficult so you’re likely to make necessary changes in a timely manner rather than pile on a little more technical debt. It’s a breeze to manage complex objects. TypeScript’s syntax maps nicely and neatly to many common design patterns.
For me, TypeScript is like starting to cook a large, complex meal in a freshly cleaned, well organized and well-stocked kitchen. You can focus on producing a beautiful meal instead of worrying over whether you have enough unexpired tarragon in your spice rack.
It is, simply, a joy.