TypeScript adds access modifiers (public, private, protected, readonly) and parameter properties to classes, improving encapsulation for Page Objects and framework base classes.
By default members are public. private restricts access to the class itself; protected allows the class and subclasses; readonly prevents reassignment after initialization. Parameter properties are a shorthand: constructor(private driver: Driver) declares AND assigns this.driver in one line. TypeScript also supports abstract classes/methods (a base that must be implemented), implements for interfaces, and static members. Note private is enforced by the COMPILER (soft privacy); JavaScript's #private fields are hard-private at runtime. These features make Page Object and framework hierarchies clean and safe.
A base Page Object: class BasePage { constructor(protected page: Page) {} } lets subclasses use this.page while keeping it hidden from test code, encapsulating the driver.
Two developers argue whether TypeScript's private truly hides a field at runtime. Who's right?