News

Babel 7.5.0 releases with F# pipeline operator, experimental TypeScript namespaces support, and more

2 min read

Last week, the team behind Babel announced the release of Babel 7.5.0. This release ships with improved support for a few ECMAScript proposals including the F# variant of the Stage 1 pipeline operator and an official plugin for the Stage 4 dynamic import() proposal. It also comes with an experimental TypeScript namespaces support.

Following are some of the highlights from Babel 7.5.0:

F# pipeline operator

The pipeline operator proposal introduces syntactic sugar (|>) for greater readability when chaining several functions together. This operator is similar to F#, OCaml, Elixir, Elm, Julia, Hack, and LiveScript, as well as UNIX pipes.

Starting from the 7.0.0-beta release, Babel had the “minimal” variant of the pipeline operator proposal. Then came the “Smart” variant in Babel 7.3.0 and with this release we have the F# variant. The difference between the smart and F# variant is that the latter uses the concept of arrow functions instead of “topic references” (#). “This has the advantage of being more similar to current JavaScript, at the cost of slightly less concise syntax,” the team explained as the advantage for this change.

You can test this new variant by adding ‘@babel/plugin-proposal-pipeline-operator’ to your Babel configuration. You can also try it out in the REPL by enabling the “Stage 1” preset.

Dynamic import transform

Though Babel has support for parsing dynamic imports, it does not provide a consistent way to transform them. It allows parsing import(foo), but asks developers to use webpack or ‘babel-plugin-dynamic-import-node’ to transpile it. To solve this problem, Babel 7.5.0 introduces the ‘@babel/plugin-proposal-dynamic-import’ plugin, which you can use alongside one of the module transform plugins.

Experimental TypeScript namespaces support

When TypeScript support initially came to Babel, it did not include namespaces as they require type information that can only be provided by a full TypeScript compiler and type-checker. Starting from Babel 7.5.0, you can enable experimental support for namespaces in the TypeScript plugin using the ‘allowNamespaces’ option of ‘@babel/plugin-transform-typescript’.

However, there are some limitations in this experimental support that you need to keep in mind: one, namespaces can only export immutable bindings and second, when merging multiple namespaces with the same name, their scope isn’t shared.

These were some of the updates in Babel 7.5.0. To know more in detail check out the official announcement and also the release notes.

Read Next

Babel 7 released with Typescript and JSX fragment support

How to create native mobile app with React Native [Tutorial]

Meteor 1.8 addresses technical debt of 1.7 with delayed legacy builds, upgraded to Babel 7, Mongo 4

Bhagyashree R

Share
Published by
Bhagyashree R

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago