In this post we'll shed light on ECMAScript private fields and see how they compare to the TypeScript private modifier.
JavaScript private class fields and the need for privacy
A closure is the only JavaScript native mechanism for protecting variables from access.
Closures are the foundation for a lot of private-like patterns, like the popular module pattern. But after ECMAScript 2015 classes took over in recent years, developers felt the need for more control over classes member privacy.