Writing JS for "everyone"
- A year later, ES2 was released.
- A year later, we saw ES3. So far, so good.
It took another six years, but ES6, also known as ES2015, was well worth the wait. Included were arrow functions, const, let, modules, classes, destructuring, generators, and so much more. The other huge piece of news was a commitment to annual releases.
But the ES6 release was so huge that apparently it wore everyone out because ES7 only had two features. The exponent operator and array. prototype. includes.
Although TypeScript and Babel both allow you to write standardized JS, Babel has historically been quicker to add support for stage 0 through 4 features, also known as experimental features. This means that you can often try out experimental features more quickly in Babel than with TypeScript. And of course for TypeScript to do its magic, type definition files and type annotations are required. So as you add new libraries, you need to also assure a type definition file is available in your project. If one doesn't exist, you need to create one to enjoy TypeScript's benefits when working with that code. Now I'm a fan of both of these options, but personally, I found that both type safety and autocompletion are quite good when working in ES6 in a modern editor like WebStorm, Visual Studio or Visual Studio Code. Since ES6 imports are statically analyzable, the editor can deterministically index your entire code base and thus provide reliable intellisense support on imports and the functions inside. When this is combined with the power of automated tests, Linting, Babel compilation, and great libraries like React that support declaring property types, I find that I rarely deal with tricky type-related issues at runtime. That long list of goodness that I just described catches the vast majority of issues for me at compile time even though I'm working in Babel instead of TypeScript.