Control visibility with `public`, `private`, and `protected`.
Section: Classes
Use access modifiers
typescript
typescript
class Counter {
private value = 0;
increment() {
this.value += 1;
}
}Explanation
Access modifiers are checked at compile time and influence editor API surface.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Classes
Use an abstract class
Require derived classes to implement specific methods.
Use getters and setters
Wrap computed or validated access around fields.