What is abstract class in TypeScript?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex TypeScript topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
An abstract class is a class that cannot be instantiated directly — it is designed to be subclassed. Declared with the abstract keyword: abstract class Shape { abstract area(): number; printArea(): void { console.log("Area:", this.area()); } }. Abstract classes can contain abstract methods (declared but not implemented — subclasses must implement them) and concrete methods (fully implemented and inherited). A class that extends an abstract class must implement all abstract methods, or itself be declared abstract. new Shape() is a compile-time error. Use abstract classes when you want to define a common interface and shared behavior for a family of related classes, while forcing subclasses to provide specific implementations. Abstract vs Interface: abstract classes can have constructor logic, concrete method implementations, access modifiers, and state — interfaces are purely structural contracts without any implementation.
Common Mistake
Candidates often give textbook answers here. Interviewers are more impressed when you relate the concept to a specific problem you solved in a real TypeScript project.
Previous
What are access modifiers in TypeScript?
Next
What is the difference between extends and implements in TypeScript?