# TS2445: Property '…' is protected and only accessible within class '…' and its subclasses.

> A protected member is used outside its class and its subclasses. Use a public method instead, or move the code into a subclass.

## What it means

`protected` members can be read inside the declaring class and inside classes that extend it.
Accessing one from other code, such as a function that has an instance, is reported.

## Example

```ts
class Account {
  protected balance = 0;
}
const account = new Account();
console.log(account.balance);
```

## How to fix

- Add a public method or getter that exposes what callers need.
- Move the code into a subclass, where `this.balance` is allowed.
- Make the member public if it's really part of the class's API.

Source: https://ts-r.dev/errors/TS2445/
