DEV Community

Cover image for The Pros, Cons & TypeScript
Arek Nawo
Arek Nawo

Posted on • Updated on • Originally published at

The Pros, Cons & TypeScript

JavaScript development has recently made a huge step forward in performance, features, syntax and development comfort in general. But still, it leaves a lot to be desired. One of the most important aspects of how good is the programming experience is mainly the editor support (at least for me). Autocompletion or Intellisense (if you are on to these Microsofty-kind-of things) is what I want to focus on. Face it, it's easier to write something when countless suggestions just bump up from under your cursor.


But, as you might expect, and want them to, these cannot be just random things. These are based on types - a term not so popular in JS community. If you don't know what these are then google it and see you later. So, as you may already know types are awesome! (You may agree or not but I don't care.) They provide editor support and performance optimizations for typed languages if used correctly. But, (at least as far as I know), JS is not a typed language and it's kind of one of its main selling points. Of course, untyped languages have their own totally different pros but it's definitely not the editor support. For the time being it's not so easy to implement good autocompletion support without types. And because JS isn't becoming a typed language in the near future, some alternatives have appeared. One of which is TypeScript, a language or as I can call it "a thin typed layer" built on top of JS. This creation, with a name created by a nice game of words, is aiming to provide typed-like language experience without changing the base JS syntax. In addition, it adds support for some syntax sugar available in ES-next.

So... - "Long live TypeScript!" - right?

Well... not exactly. You see, TS looks just great from the top - no new syntax (if not counting the types, of course), editor support (VS-Code especially) and "backward" compatibility with JS.


You know what it means, right?

Backward compatibility is a property of a system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especially in telecommunications and computing.


In this situation, JS isn't old or legacy - it's not important. The word interoperability is the key. In TypeScript, you can import the JS library, but it won't obviously magically generate typing for this particular code. That may not seem so, but becomes quite problematic when you want to use TS "full-potential" in its strict mode. Then you get some nifty errors (unless you hack your way through TS configuration) and no type-safety, which is pretty bad for my lacking. But don't worry d.ts (TypeScript Declaration) files are here to help! Of course only if you've got time to do a thing such as writing TS binding for some enormous library. Well, you're not alone here as well. Say hello to DefinitelyTyped where other people sharing the need with you have already covered many popular JS libraries. Sadly, not all (so unexpected) and that's the main problem. You can type something that is untyped from the beginning without doing anything. But apart from this and the fact that TS type system lack some (not really needed but helpful) features, then yes - "Long live TypeScript!" and actually, this statement is becoming reality.

Other options

At the time of writing this post, there are only two main competitors to TypeScript - Flow & JSDoc itself. As this wasn't meant to be about them, I'll make it clear:


  • OSS made by nice guys from facebook;
  • It's a type checker not a new language;
  • Has similar typing system to TS;
  • Supported in most of modern editors;
  • Performance is a bit laggy, but fine;
  • Has smaller type base than TS;
  • Better support for React than TS;


  • OSS project & kind of documentation standard;
  • Implemented in form of comments in JS;
  • No performance decreasement from normal JS;
  • Different typing system that that of TS / Flow;
  • Can be harder to create complex types than in TS / Flow;
  • Supported in almost all editors;
  • Documentation generator extra;

Personal preference

Personally, since I discover TypeScript I can't stop using it. The editor autocompletion support it provides is just mandatory for me. I tried to use Flow and JSDoc but honestly these weren't any better than TS (just my opinion). Of course, lack of typings for some libraries can be problematic but it isn't really something I can blame TS for. So my recommendation? Just pick one of the mentioned projects, whether it'll be TypeScript, Flow or just JSDoc if you haven't already and if you have, then don't forget to share this post to those who haven't. Have a nice, typey day.

Discussion (6)

qm3ster profile image
Mihail Malo • Edited on

Picking Flow in 2018 is a bad idea imo.
It's not strictly a shot in the foot, as the two are extremely similar, so the knowledge is portable, but:

  1. It's a worse experience, especially if you are addicted to VS Code
  2. There are less type definitions available (both community ala @types/ and built in).

These two hit newcomers especially hard and might discourage them from typed JavaScript, which is really the only type of handwritten JavaScript one should be doing.

Source: I've used both to the limit.

Also, some will say that flowtype is more functional and TypeScript is more Object-Oriented. Besides like two keywords of syntax that is a lie and just a way to drag TypeScript through the mire. Both use duck/structural typing, and both can usually fully type your higher order functions with comparable verbosity.

ryanmaffey profile image
Ryan Maffey

I’m a big fan of TypeScript. I’ve used Flow before but found it a less enjoyable experience (particularly relating to its performance compared to TS - it felt rather sluggish).

qm3ster profile image
Mihail Malo

@ryanmaffey serious question - were you on a laptop?
I've used it with Atom integration, and I was having a very ok time performance wise, since it wasn't rechecking every file every time.
Was this about your hardware or about rechecking the whole project tree?

ryanmaffey profile image
Ryan Maffey

@qm3ster - no, it was an iMac, only a couple of years old I think. It’s much more likely down to the size of the project than the hardware.

areknawo profile image
Arek Nawo Author

Glad to hear that, big fan too! πŸ˜‰

jwp profile image
John Peters

The js community's rejection of Typescript is similar to assembly language progrmmers rejecting c or c#. Which they did. Nobody likes change, but to reject typescript, is true stupidity, absolute nonsense. Compilers are here to stay. Forget babel and runtime only debugging.