JavaScript Private Fields and TypeScript
Learn how JavaScript ES6 introduces private fields with the hash symbol and compare this approach to TypeScript's access modifiers like private, readonly, and protected. Understand how these features work in TypeScript classes, constructors, and how they translate in compiled JavaScript.
We'll cover the following...
We'll cover the following...
Introduction to ES6 private fields
An experimental proposal to the ECMAScript standard introduces the concept of a private field by using the hash (#) symbol before a property name.
This means that if we are targeting a runtime that ...