LearnNewsExamplesServices
Frontmatter
id1228
titleAdd support for public class fields
stateClosed
labels
enhancement
assignees[]
createdAtSep 29, 2020, 2:38 PM
updatedAtApr 25, 2021, 10:58 AM
githubUrlhttps://github.com/neomjs/neo/issues/1228
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 25, 2021, 10:58 AM

Add support for public class fields

Closed v8.1.0 enhancement
tobiu
tobiu commented on Sep 29, 2020, 2:38 PM

Public class fields are a stage3 proposal for a very long time already: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields

If you look close at the browser support, safari did catch up and this looks reasonable to use at this point. The only exception is Firefox for Android, which we can ignore.

With added support for class fields, we can move all configs without a trailing underscore into the class body directly (e.g. className or ntype).

The only downside is, that webpack is not able to build stage3 proposals: https://github.com/webpack/webpack/issues/10216

More precisely: the internal parser (Acorn) needs to get adjusted, which is not possible using webpack based configs.

Screenshot 2020-09-29 at 14 22 37

To add support for all (...) stage3 proposals, we could adjust the package.json and add a resolutions prop: https://github.com/OnurGvnc/acorn-with-stage3

This one only works with yarn. To make it work with npm, we also need to add: https://github.com/rogeriochaves/npm-force-resolutions

It feels worth a try. In case we get it working for neo, we could probably get rid of the trailing underscore for configs completely (a breaking change).

tobiu added the enhancement label on Sep 29, 2020, 2:38 PM
tobiu closed this issue on Apr 25, 2021, 10:58 AM