Add ECMAScript 2020 features?
See original GitHub issue@babel/plugin-proposal-nullish-coalescing-operator
and @babel/plugin-proposal-optional-chaining
were just added to @babel/preset-env
with the release of 7.8.0
— should they also make an appearance here?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
The Latest Features Added to JavaScript in ECMAScript 2020
The Latest Features Added to JavaScript in ECMAScript 2020 · Optional Chaining · Nullish Coalescing · Private Fields · Static Fields · Top...
Read more >JavaScript: What's New in ECMAScript 2020 - Auth0
Learn the new features introduced by ECMAScript 2020 in JavaScript.
Read more >JavaScript: Guide to New ECMAScript 2020 Features
JavaScript: Guide to New ECMAScript 2020 Features · GlobalThis · Nullish coalescing operator · Optional chaining operator · Dynamic import · Import.
Read more >ECMAScript 2020 biggest new features - Arek Nawo
Newsletter · Thanks! · ECMAScript 2020 biggest new features · BigInt · Dynamic imports · Nullish coalescing operator · Optional chaining operator.
Read more >ECMAScript 2020 spec for JavaScript approved - InfoWorld
The latest standard for JavaScript, ECMAScript 2020 introduces new features for module loading, precision integers, and strings.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
preset-env
has theshippedProposals
option, for proposals which are not part of the specification yet but are already shipped in at least one browser/node. We should probably addclass-fields
to that option.@developit Looking at your plugin, I think that you misinterpreted the reason for using the optimized [[Set]] in the plugin.
Object.defineProperty
is unrelated tothis.bar = 2
in the constructor: it’s needed when there is a setter on the prototype of the class (almost always coming from a superclass or a subclass, but could also come fromObject.prototype
or from the class itself) because the setter shouldn’t be triggered. This isn’t statically analyzable, because almost always the base and derived classes are in two different files.Also, the descriptor you pass to
defineProperty
must have theenumerable: true, configurable: true, writable: true
properties. If you replicate this descriptor a bunch of times (for different properties), then it’s longer than using the helper.I don’t think that it’s possible to make a spec-compliant version of the plugin smaller than the current one, and if someone isn’t concerned with spec compliancy in the [[Set]] vs [[Define]] case they can already enable loose mode, which produces this output:
Optional chaining and nullish coalescing are standard / stage 4.
Class fields are stage 3, and shipping in browsers, which is a more important milestone for Babel imo than the stage.