TypeScript has silently won the web development

Roughly 10 months ago I've written about the way Babel.js (& ES6) has changed web development in such a short time. Let me remind you just my final conclusion:

You don't have to wait anymore, there's really no reason to postpone adapting Babel/ES6 in your current development.

But that was 10 months ago & ... situation has developed in an interesting way since then. No-one seems to care about new framework hype-trains anymore - the most interesting (& widely commented) improvements affect the language (JavaScript) itself: JSX, Flow & ... (vacuumed & improved :>) TypeScript.

When there was no hope

I have to admit that initially I was very skeptical about TypeScript (it seems it was not only me, web is full of similar confessions made by contrite doubters ...) - these were the days of ECMAScript pre-6 (adoption of 5 was very limited as well), so it was hard to predict the direction it will head towards. Actually there wasn't much belief it will be possible to align all the big players to enable any evolution all would agree to.

JavaScript seemed carved in stone.
JavaScript seemed eternal.

But today it's 2016 & the miracle has happened. JavaScript has gradually evolved ... towards TypeScript. It is said that these two will be a full match in ECMAScript 7 or 8. And it's not just Microsoft supporting it, Google has adopted TypeScript as a preferred language for Angular 2 & Ionic 2 applications development ... Everyone's already publishing typings definitions for existing JavaScript libraries (so they don't have to be fully ported to TypeScript).

Hell has frozen over.

Where's the cookie?

The coolest thing is that ... TypeScript truly makes a difference in a day-to-day development:

  1. (smart) type annotations (incl. type inference) - that enable compile-time type checking
  2. interfaces & mix-ins - invaluable for proper code composition (ok, mix-ins in TS are ... specific, but there's for a good reason)
  3. generics - help with re-usable design & building truly expressive code
  4. tuples & plenty of tiny tweaks (annotations, decorators, etc.) - to improve Development Experience (DX) with healthy dose of syntactic sugar

It will NOT enable completely new development capabilities - TS is just JS'es superset that still gets compiled to ol' good ES. BUT it helps with:

  • building MUCH better IDE support (due to type control) - e.g. Intellisense, smart refactorings, early issue detection, etc.
  • scaling out development (growing code base with an efficient code re-use & reasonable dependencies)
  • troubleshooting / reading / maintaining code (especially if it's large & shared)

It's not perfect, there were situations I struggled a lot & cursed a lot - missing / outdated typings, duplicated symbols, two pass transpiling TS->ES6->ES5, ... But in the end, it was (it IS!) really worth it. Especially today, with tremendous (& continuously improving) tooling (in my case: WebStorm, Atom, Visual Studio Code). TypeScript is basically JavaScript I always wanted to have (& use) ;)

Full speed ahead

The course is set & I don't believe it will change within next 2 years or so (I may regret these words at some point, I know ...). It seems that TypeScript is not only the future, it is also the present. Let me end with a rephrased version of the statement I've used 10 months ago regarding Babel & ES6:

Today there's no reason not to use TypeScript as a primary web development language - regardless of libraries / frameworks you use. By passing on it, you deliberately give up clear, tangible benefits. By embracing it, you don't take a significant risk or pay any other visible price.

Happy TypeScripting.

Pic: © fotobieshutterb - Fotolia.com