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.2.0 Released: Private Instance Methods

December 3, 2018

Nicolò Ribaudo

We just released a new minor version of Babel!

This release includes support for private instance methods and a bunch of bug fixes regarding Flow and TypeScript types. You can read the whole changelog on GitHub.

A lot of new contributors fixed bugs or implemented new features in this release: thanks to Gcaufy, Grigory Moroz, Paul Happ, Tim McClure and Veaceslav Cotruta!

A big shout out to Bloomberg for sponsoring the implementation of private class elements! This support for private instance methods is a follow-up to private static fields released in Babel 7.1.0.

If you or your company wants 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!

Private Instance Methods (#8654)

class Person {
  #age = 19;

  #increaseAge() {
    this.#age++;
  }

  birthday() {
    this.#increaseAge();
    alert("Happy Birthday!");
  }
}

Thanks to Tim for implementing this proposal, and to Nicolò and Justin for the reviews!

You can test private methods by adding the @babel/plugin-proposal-private-methods plugin to your Babel configuration, or enabling the stage-3 preset in the repl.

Private accessors are also coming, and we have done some big internal refactoring that allows us to add support for private elements to decorators soon 🎉.

"Smart" Pipeline Operator Parsing (#8289)

Thanks to the work of James DiGioia and J. S. Choi, @babel/parser now also can parse the Smart Pipeline Operator, in addition to the minimal version.

We currently only support the "core" of the smart pipeline proposal, and not any additional features. We also currently support only # as a preliminary placeholder. The actual placeholder has not yet been decided, and other possibilities such as ?, @, and % may be experimentally supported by @babel/parser in the future.

// "Smart"
const result = 2 |> double |> 3 + # |> toStringBase(2, #); // "111"

// "Simple"
const result = 2 |> double |> (x => 3 + x) |> (x => toStringBase(2, x));

Babel implements multiple variants of this proposal to help TC39 test and gather feedback from the community. As with all proposals, expect changes in the future.

If you are directly using @babel/parser and you want to test this proposal, you can pass the proposal: "smart" option to the pipeline plugin:

const ast = babel.parse(code, {
  plugins: [
    ["pipelineOperator", { proposal: "smart" }]
  ]
})

We don't support transpiling this syntax yet, but it will come soon.

Plugin Names (#8769)

Every official plugin now provides Babel its name. Although this doesn't affect normal Babel use, it provides a consistent identifier for each plugin. This is particularly useful for things like Time Travel, which allows you to see exactly what each plugin is doing to your code. You can see this in effect via our repl:


Discuss on Twitter

Recent Posts
  • Private Instance Methods (#8654)
  • "Smart" Pipeline Operator Parsing (#8289)
  • Plugin Names (#8769)
Babel
Docs
Learn ES2015
Community
VideosUser ShowcaseStack OverflowSlack ChannelTwitter
More
BlogGitHub OrgGitHub RepoWebsite RepoOld 6.x SiteOld 5.x Site