Babel 7 Released With Improved TypeScript Support
Written by Ian Elliot   
Tuesday, 28 August 2018

Babel was once the lifesaver for many JavaScript projects. It took "future" JavaScript and compiled it to "current" JavaScript. But now the future has arrived, almost, and the question is do we need a compile step to slow things down?

babel

Things at Babel haven't been running smoothly for a while, but now version 7 is ready:

"After almost 2 years, 4k commits, over 50 pre-releases, and a lot of help we are excited to announce the release of Babel 7. It's been almost 3 years since the release of Babel 6! There's a lot of moving parts so please bear with us in the first weeks of release."

Babel used to have an undeniable use case. JavaScript was rapidly introducing new and desirable features, but browser makers weren't including the features fast enough and users weren't able to use them. It is still the case that there are many legacy browsers that can't cope with ES2015, but all of the current browsers can.  The use case for Babel is a lot less compelling than it was and it makes the whole idea of putting a compiler between you and the final code a lot less attractive.

Of course, if you have to support older browsers then this is a good choice and arguably much better than including polyfils - although Babel does have to use polyfil code to support some features.

So what is new?

There are a range of breaking changes to configuration and use and there is a new tool to help in porting to the new version. There are ES2018 and Stage 3, 2 and 1 features but, as the announcement says, these are subject to change. I have to say that there is nothing in the list that is as exciting as the new features in ES2015 and 16. This is perhaps how it should be; JavaScript is mostly "fixed" now and it's time to consolidate.

A big new feature is better TypeScript support. If you are using TypeScript then this probably isn't going to change anything for you. After all, TypeScript already compiles to JavaScript. If you are a Babel user then you can now compile TypeScript, but notice that you won't get TypeScript's type checking.

An experimental system for loading only the polyfils that are needed is now available to slim your code down.

So does Babel have a future?

The blog post announcing this latest version seems to think so and puts forward the point of view that as long as JavaScript keeps adding features then there will be work to do.

I'm not as convinced.

Most of the new features in JavaScript are now "nice" rather than essential. When we moved to ES2015 things like class, Promise and Async/Await seemed like things we had to have to write big programs. Now the features are tinkering with the language and if you can't use them you are not missing much. As for TypeScript support - well it is difficult not to see TypeScript as a competitor to Babel. It is arguably a better JavaScript and it compiles to ECMAScript 3 or later.

The only role for Babel in the future is in producing code that runs on legacy browsers while allowing you to write in the latest version of JavaScript. This is probably enough to keep the project going, but the majority of JavaScript developers are simply going to code in ES2015 and forget browsers that currently fewer than 15% of users are stuck with.

babel

 

More Information

Babel 7 Released

Related Articles

Babel 6 More Than A JavaScript Modernizer

6to5 Renamed As Babel - Are You Ready For The Next Gen JavaScript?       

JavaScript 6 EcmaScript 2015 Final Approval         


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


52nd Mersenne Prime Found
27/10/2024

It has been nearly six years since the last Mersenne prime was discovered. Now, at last, we have Mersenne prime number 52 and it has 41,024,320 digits!



Extend NGINX With The New JavaScript Module
28/10/2024

Inject middleware functionality into NGINX with the expressive power of Javascript. NGINX JavaScript or NJS for short is a dynamic module under which you can use scripting for hooking into the NGINX e [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

<ASIN:1871962579>

<ASIN:1871962560>

 

Last Updated ( Wednesday, 19 September 2018 )