Implement private fields proposal
Problem
I think it would be nice to have the stage 1 private fields proposal implemented in TypeScript. It'll mostly supercede the current pseudo-private implementation, and a fully-correct implementation is only transpliable to ES6 using per-class WeakMaps. I'll note that the spec itself uses WeakMaps internally to model the private state, which may help in implementing the proposal. Currently, the proposal only includes private _properties_, but methods are likely to follow. Also, the most important part of the proposal is that private properties are only available within the class itself.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Implement private fields proposal
I don't think people will be happy with a non "private" keyword based solution.
Trust Score
8 verifications
- 1
I don't think people will be happy with a non "private" keyword based solution.
I don't think people will be happy with a non "private" keyword based solution.
Validation
Resolved in microsoft/TypeScript GitHub issue #9950. Community reactions: 53 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep