How do ECMAScript Private Fields Work in TypeScript?

I was reading the release notes for the TypeScript 3.8 beta the other day and there’s a particular feature in there that caught my eye, Private Fields. This is support for the stage 3 proposal which means it’s a candidate for inclusion in a…


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail

I was reading the release notes for the TypeScript 3.8 beta the other day and there’s a particular feature in there that caught my eye, Private Fields. This is support for the stage 3 proposal which means it’s a candidate for inclusion in a future language version (more info on the stages can be found here). What I found interesting is that although TypeScript has supported a private keyword it doesn’t actually make the field private, it just tells the compiler, meaning that in “plain old JavaScript” you can still access the field, whereas the Private Fields implementation makes it properly truly private, you can’t access it.


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail


Print Share Comment Cite Upload Translate Updates
APA

Posts on LINQ to Fail | Sciencx (2020-01-22T22:51:02+00:00) How do ECMAScript Private Fields Work in TypeScript?. Retrieved from https://www.scien.cx/2020/01/22/how-do-ecmascript-private-fields-work-in-typescript/

MLA
" » How do ECMAScript Private Fields Work in TypeScript?." Posts on LINQ to Fail | Sciencx - Wednesday January 22, 2020, https://www.scien.cx/2020/01/22/how-do-ecmascript-private-fields-work-in-typescript/
HARVARD
Posts on LINQ to Fail | Sciencx Wednesday January 22, 2020 » How do ECMAScript Private Fields Work in TypeScript?., viewed ,<https://www.scien.cx/2020/01/22/how-do-ecmascript-private-fields-work-in-typescript/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » How do ECMAScript Private Fields Work in TypeScript?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2020/01/22/how-do-ecmascript-private-fields-work-in-typescript/
CHICAGO
" » How do ECMAScript Private Fields Work in TypeScript?." Posts on LINQ to Fail | Sciencx - Accessed . https://www.scien.cx/2020/01/22/how-do-ecmascript-private-fields-work-in-typescript/
IEEE
" » How do ECMAScript Private Fields Work in TypeScript?." Posts on LINQ to Fail | Sciencx [Online]. Available: https://www.scien.cx/2020/01/22/how-do-ecmascript-private-fields-work-in-typescript/. [Accessed: ]
rf:citation
» How do ECMAScript Private Fields Work in TypeScript? | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2020/01/22/how-do-ecmascript-private-fields-work-in-typescript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.