How to learn advanced TypeScript and how to get better at Typescript

Table of contents

I love Typescript. It is very powerful and although it does have some disadvantages, once you start using it to its full capability it really speeds up development and decreases the potential for bugs to be introduced.

One of the great things about Typescript is that it is a superset of Javascript, so all Javascript is valid. This makes converting an existing Javascript application to Typescript quite easy - you can just type everything with :any (this isn't good advice!). But doing this will not teach you how to best use Typescript.

Here are some of the most useful resources I've found helped me go from Javascript to Typescript.

Best Typescript books

I've only read one physical Typescript book - Effective TypeScript (link), published by O'Reilly. I would 100% recommend this book. It doesn't cover the basics, there is no introduction to Typescript - so only get this once you have played with Typescript enough to know the basics.

But when it comes to the best Typescript ebooks I've read quite a few. The ones that stand out and that I recommend reading are:

  • Refactoring TypeScript by James Hickey link - again not a beginners guide but 100% worth getting.
  • Essential TypeScript by Jess Chadwick (free) link- this is what I would recommend for absolute beginners
  • Typescript Deep Dive (free) link - A fantastic resource that every TypeScript developer should read through

    Both of those are available on Leanpub.

Best resources to improve your typing abilities

The best way to get used to typing in Typescript is to practice. Two of the best resources I've found (which have challenges for you to do) are:

  • Type challenges link - This is a Github repo which links to a Typescript playground (such as this), so you can work out how to complete the challenge and get it typed correctly. You can view the answers in the repo PRs too
  • Typescript exercises link this is a slightly more structured collection of Typing challenges. There are currently 16 for you to do.

Using those two resources alone (once I knew the basics very well) were the only way that I started to really understand generics and how to correctly type things with use of the TypeScript keywords infer, extends, etc.

How to keep up to date with the latest Typescript developments and releases

I keep up to date with Typescript via the fantastic newsletter TypeScript weekly. If you work with TS then you should be getting this in your inbox every week.

They have been running their newsletter for several years.

Another very important thing to be aware of is the Typescript release notes from Microsoft.

Every TS release (which comes quite frequently) adds many new features, and they always have very good documentation explaining the new feature (and why it was introduced). You can also follow them on Twitter @typescript

Suggestions?

I'd love to hear ideas of other great Typescript resources. Please leave a comment below. (no registration required, just hit "comment as a guest").

Comments How to learn advanced TypeScript and how to get better at Typescript