TypeScript is an open-source language invented by
moved up in popularity on GitHub; as of the end of 2019, it is the seventh-most
popular language, according to GitHub’s annual
this meme is pretty accurate (and pretty funny). While the language has some
great features, some of them are a bit too flexible (especially around types),
which means you can end up with some nasty bugs.
For example, no matter how good of a programmer
functions for other people to use, there’s not much you can do to stop users of
your library from sending incorrect objects and types into your functions. Of
course, you could start every single function with a “typedef” test, and throw
an exception when the wrong type is sent in. But at that point, you’re
basically forcing a strict typing of sorts into your code.
So why not just use a language that has strict
typing built in? That’s where TypeScript comes in. Because it’s a superset of
TypeScript adds features found in other languages to enforce strict typing and
You can use the native TypeScript transpiler, and Babel also provides
The features also go beyond just types; for
for classes, TypeScript takes it a few steps further, including support for
private members. Again, this helps prevent bugs.
If you do move towards TypeScript, make sure you
understand the more complex language features, such as:
You can explore these in the official
might feel like you need TypeScript and are unable to do your programming in
going to go away; it’s also not likely that the features that make TypeScript
unique (its typing system in particular) will make their way into the
mastering both, you’ll open up more opportunities.