Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
new feature: Private Fields (T7508) #4408
[[ https://github.com/tc39/proposal-private-fields | Private Fields ]]
If this is of any help, I explained a way this could be fully and correctly transpiled to ES6 using WeakMaps here,  and most notably, the spec uses. ES5 is a different story, as it doesn't have a weak map, nor anything that could resemble one. The closest you could get would be an almost-correct polyfill using Symbols + the core-js polyfill if necessary.
Oh, and it's an early error (i.e. syntax error) if a private reference can't be statically resolved, so the error should be thrown from Babylon, not any transformer.
 The current proposal lives here, but it hasn't changed much.
Current proposal has changed recently. Now Private Fields are based on Internal Slots rather than WeakMaps. However WeakMaps still could be used to transpile feature to ES6 (tc39/proposal-private-fields#42 (comment), https://github.com/tc39/proposal-private-fields#private-field-identiers)
referenced this issue
Dec 10, 2016
Will be almost certainly a prerequisite for stage3 that they get presented "together or as a package" probably aligning very closely.
I said merge in the sense that the code might end up differing just on a flag private on the classField type, so I'm just making sure I clean a little bit the classBody code, so its easy to refactor in the future.
I am a bit new on staying up to date with latest features. I would really like to make use of this, how do I get this feature 'enabled' on my babel?
My package versions: