Typescript: ECMAScript Private fields not implemented in 3.7?

Created on 10 Oct 2019  路  5Comments  路  Source: microsoft/TypeScript

According to the ~release notes and~ iteration plan, the private fields proposal for ECMAScript is supposed to be part of 3.7, but #30829 doesn't appear to be merged yet, and the actual syntax still causes an error. Is it still planned for the 3.7 release, or will it come later with a 3.7 patch (or 3.8)?

TypeScript Version: 3.7.0-beta

Search Terms: private fields, ecma private

Code

class FooBar {
    #fizz: string = '';
    private buzz: string = '';
}

Expected behavior: This should be valid syntax in 3.7.0-beta, according to the release notes and issue tracker.

Actual behavior: This does not appear to be valid syntax in the beta.

Playground Link: https://www.typescriptlang.org/play/index.html?ts=3.7-Beta&ssl=1&ssc=1&pln=4&pc=2#code/MYGwhgzhAEBiD28BCYBO0DeAoavoGIAzASwC9SAuaCAF1WIDsBzaAXmgHIOBuHPAB3oA3MDQCm0AEYBXclVr1mbTjywBfIA

Question

Most helpful comment

Wouldn't it be better to ask that question on the iteration plan issue, or the existing issues instead of opening a new one? I don't know if you have noticed, but there is a lot of noise, which you are adding to.

All 5 comments

According to the beta release notes is not part, the PR is not merged #30829.

Good point. It is mentioned a few times in the iteration plan (#33352), though. So I was mainly wondering if it's still planned to happen in 3.7 (even if not the initial release) or if it's been bumped to 3.8.

Wouldn't it be better to ask that question on the iteration plan issue, or the existing issues instead of opening a new one? I don't know if you have noticed, but there is a lot of noise, which you are adding to.

This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow.

Right before the 3.7 feature window closed, we were made aware of a post made to a private TC39 forum that indicated the class fields proposal was possibly not going to move forward with the currently-proposed semantics. Additionally, the proposal covers both private and public fields, the latter of which has runtime breaking change impact on many TypeScript users, and we've exercised additional caution in the interests of not causing more ambiguity or migration pain than absolutely necessary.

For these reasons, we held off on merging the feature in 3.7. We're committed to merging the feature once it is clear that the semantics of private and public fields are headed to stage 4 without major changes.

Was this page helpful?
0 / 5 - 0 ratings