TypeScript vs ECMAScript 2015/2016
What does TypeScript offer us?
A handy feature of TypeScript courtesy of its strict types is that it addresses issues with the loose equality operator
== two values with non-matching types like
String and produce an error.
You also have to factor in to the equation that TypeScript made its debut in 2012, before we had the great choice of front-end tooling and support we do today thanks to the concentrated efforts of the TC39 committee.
If you’re working in a large codebase (the purpose of which TypeScript was originally designed for), then there is a benefit to TypeScript how it strictly enforces types. It is more verbose and designed to catch errors earlier before they’re introduced into a codebase.
While TypeScript offers many other features, the strong typing is definitely the biggest and unique aspect of TypeScript that sells it. As witnessed in TypeScript 1.5, a lot of ECMAScript 2015 features were rolled into it and presumably TypeScript 1.6 will roll in more features from the current and future specification.
As much as I think TypeScript is great, I believe using it is a niche preference that boils down to; if you’re comfortable with C# or Java, you use Visual Studio as your IDE of choice, you have a lot of type guards in your code (instanceof checks), you are working on a massive codebase and finally: you work on a large team and you want to avoid styleguide clashes, ensure that all developers are writing the same code, the same way.
typeof to check types before using/mutating them.