TypeScript 3.8 beta adds support for ECMAScript private fields

TypeScript’s popularity among JavaScript programmers makes it an essential component of modern JS development. The latest version, TypeScript 3.8 Beta, contains new features including new syntax for importing and exporting only types. Give the beta release a try and experience all of the latest features before the final release arrives.
TypeScript, the superset of JavaScript, offers minimal configuration management and IDE support, while still providing the benefit of JavaScript libraries. It adds optional static type-checking and type syntax and works with all browsers and operating systems.
Released on January 10, 2020, TypeScript 3.8 Beta includes features that users can expect to find in the final version. Give the beta a try and familiarize yourself with what is coming in the final release.
This version includes the support and collaborative efforts of the Bloomberg engineering team.
SEE ALSO: How can you make a JavaScript website successful in Google?
v3.8 beta features
Daniel Rosenwasser, TypeScript program manager, dives deep into the new features in the Microsoft announcement post.
Take a look at the recent arrival. Some of the highlights of v3.8 beta include:
Private fields
Thanks to contributions from Bloomberg, support for ECMAScript’s private fields arrives. It is currently in the third stage of development, which indicates that further refinement and feedback are needed before it is included in the formal ECMAScript standard.
Rosenwasser notes that with the introduction of private fields comes a few new rules.
- Private fields start with a
#
character. Sometimes we call these private names.- Every private field name is uniquely scoped to its containing class.
- TypeScript accessibility modifiers like
public
orprivate
can’t be used on private fields.- Private fields can’t be accessed or even detected outside of the containing class – even by JS users! Sometimes we call this hard privacy.
View more information about public and private class fields in the proposal.