TypeScript · Classes and modules

abstract class

A base class that cannot be instantiated and may declare abstract members subclasses must implement.

Syntax
abstract class Shape

Example

Example
abstract class Shape {
  abstract area(): number;
}
class Square extends Shape {
  constructor(private size: number) { super(); }
  area() { return this.size ** 2; }
}

More in this group

Access modifiers Class Declaration file implements Namespace import readonly field Type-only import

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course