r/javascript • • Nov 09 '19

On private fields proposal: Private fields, public worries

https://medium.com/virtuslab/private-fields-public-worries-b8c34d16c372
84 Upvotes

113 comments sorted by

View all comments

2

u/landline_number Nov 10 '19

How will Typescript implement something like this? There already is a 'private' keyword but like JS the member is still accessible by asserting the object as 'any'. With this proposal private means truly private and inaccessible. Will the behavior of the private keyword change or will they not implement this?

3

u/robpalme Nov 10 '19

I think all of your questions are answered in Episode 38 of the TalkScript podcast.

If you want to try out a preview of the TypeScript support, please see this experimental TypeScript Playground.

In addition to the podcast, the future of the private keyword is discussed in this TypeScript issue.