Babel
  • Docs
  • Setup
  • Try it out
  • Videos
  • Blog
  • Donate
  • Team
  • GitHub

›All Blog Posts

All Blog Posts

  • 7.13.0 Released: Records and Tuples, granular compiler assumptions, and top-level targets
  • 7.12.0 Released: TypeScript 4.1, strings as import/export names, and class static blocks
  • 7.11.0 Released: ECMAScript 2021 support in preset-env, TypeScript 4.0 support, printing config and the future of `babel-eslint`
  • The State of babel-eslint
  • 7.10.0 Released: Class Fields in preset-env, '#private in' checks and better React tree-shaking
  • 7.9.0 Released: Smaller preset-env output, Typescript 3.8 support and a new JSX transform
  • 7.8.0 Released: ECMAScript 2020, .mjs configuration files and @babel/cli improvements
  • Babel's Funding Plans
  • 7.7.0 Released: Error recovery and TypeScript 3.7
  • 7.6.0 Released: Private static accessors and V8 intrinsic syntax
  • 7.5.0 Released: dynamic import and F# pipelines
  • The Babel Podcast
  • 7.4.0 Released: core-js 3, static private methods and partial application
  • 7.3.0 Released: Named capturing groups, private instance accessors and smart pipelines
  • 7.2.0 Released: Private Instance Methods
  • TC39 Standards Track Decorators in Babel
  • 7.1.0 Released: Decorators, Private Static Fields
  • Babel 7 Released
  • Removing Babel's Stage Presets
  • What's Happening With the Pipeline (|>) Proposal?
  • Announcing Babel's New Partnership with trivago!
  • On Consuming (and Publishing) ES2015+ Packages
  • Nearing the 7.0 Release
  • Babel Turns Three
  • Planning for 7.0
  • Zero-config code transformation with babel-plugin-macros
  • Contributing to Babel: Three Lessons to Remember
  • Personal Experiences at Babel #1 — A PR with Unusually High Number of Reviews
  • Babel and Summer of Code 2017
  • Upgrade to Babel 7 (moved)
  • Upgrade to Babel 7 for Tool Authors (WIP)
  • 6.23.0 Released
  • The State of Babel
  • 6.19.0 Released
  • 6.18.0 Released
  • 6.16.0 Released
  • Babili (babel-minify)
  • 6.14.0 Released
  • Babel Doctor
  • Setting up Babel 6
  • 6.0.0 Released
  • React on ES6+
  • Function Bind Syntax
  • 5.0.0 Released
  • Babel <3 React
  • Not Born to Die
  • 2to3
  • 6to5 + esnext

7.6.0 Released: Private static accessors and V8 intrinsic syntax

September 5, 2019

Nicolò Ribaudo

We just released a new minor Babel version!

It includes support for static private accessors in classes, and parser support for the V8 intrinsics syntax. We also fixed a bunch of long-standing issues related to TDZ handling, and improved support for do-expressions. You can read the whole changelog on GitHub.

Thanks to Serhii Muryhin, Ashwin Ramaswami, Sungmin Lee, Serge Havas, Ziad El Khoury Hanna, Even Alander, Shrey Banga, Dylan Kirkby, Ajay Sagar, Adam Ramberg, and Bin Xin for their first PRs! (And also thanks to Codetriage README Bot and dependabot 🤖)

Bloomberg is continuing to sponsor the implementation of new class features in Babel: after giving us a lot of new class features (static private fields, private instance methods, private instance accessors, and static private methods), they've just implemented static private getters and setters.

Another big shout out goes to Frontend Masters for making two big donations this past month, as well as all our other sponsors who allow the Babel team to spend more time on the project!

If you or your company want to support Babel and the evolution of JavaScript, but aren't sure how, you can donate to us on OpenCollective and, better yet, work with us on the implementation of new ECMAScript proposals directly! As a volunteer-driven project, we rely on the community's support to both fund our efforts in supporting the wide range of JavaScript users and taking ownership of the code. Reach out to Henry at henry@babeljs.io if you'd like to talk more!

Private static accessors (getters and setters) (#10217)

class Resource {
  static #loaderInstance = null;

  static get #loader() {
    if (!this.#loaderInstance) this.#loaderInstance = new Loader();
    return this.#loaderInstance;
  }

  status = null;
  
  constructor(url) {
    this.status = Resource.#loader.load(url);
  }
}

Thanks to Tim (Bloomberg) for implementing this proposal!

You can test this new feature by adding @babel/plugin-proposal-private-methods to your config, if you haven't already added it, or by enabling the stage-3 preset in the online repl.

Class private features support is finally complete 🎉

Class PrivateInstanceStatic
Fields
class A { #a = 1 }
7.0.07.1.0
Methods
class A { #a() {} }
7.2.07.4.0
Accessors
class A { get #a() {} }
7.3.07.6.0

It's time to party!

V8 intrinsic runtime functions parsing (#10148)

⚠️ This is a non-standard extension to the language, which can only be used in V8 when enabling the --allow-natives-syntax command-line flag.

V8, the JavaScript engine used by Node.js and Chromium-based browsers, can expose various pieces of internal functionality as JavaScript functions. Although these APIs must not be used in production JavaScript code, these special functions can be useful in testing and debugging scenarios — for example, to understand how your JavaScript values are represented in memory, or to call some ECMAScript specification routines directly.

These so-called “V8 intrinsics” have a different syntax than normal functions: their name always starts with %. Also, they can only be directly called and never used as normal values (you can't, for example, assign them to another variable).

function fn() { /* ... */ }

const status = %GetOptimizationStatus(fn);

if (status === 2) {
  console.log("The function is not optimized!");
}

You can find the whole list of existing V8 intrinsics in V8's source code.

You can enable this syntax in @babel/parser by using the v8intrinsic plugin:

const { parse } = require("@babel/parser");

parse(code, {
  plugins: ["v8intrinsic"]
})

Nullish coalescing operator (??) updates (#10269)

The nullish coalescing stage 3 proposal recently got some updates: to avoid confusion over precedence with other logical operators (&& and ||), the spec has been changed to disallow mixing them.

This means that the following expressions are now invalid:

a ?? b || c;
a && b ?? c;

Instead, you should add parentheses where appropriate:

(a ?? b) || c; /* or */ a ?? (b || c);
(a && b) ?? c; /* or */ a && (b ?? c);

This is similar to how unary minus (-) and the exponentiation operator (**) interact: you can't write -1 ** 2, but you have to choose between (-1) ** 2 and -(1 ** 2).

Recent Posts
  • Private static accessors (getters and setters) (#10217)
  • V8 intrinsic runtime functions parsing (#10148)
  • Nullish coalescing operator (??) updates (#10269)
Babel
Docs
Learn ES2015
Community
VideosUser ShowcaseStack OverflowSlack ChannelTwitter
More
BlogGitHub OrgGitHub RepoWebsite RepoOld 6.x SiteOld 5.x Site