O'Reilly logo

Mastering TypeScript by Nathan Rozentals

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inheritance

Inheritance is another paradigm that is one of the cornerstones of object-oriented programming. Inheritance means that an object uses another object as its base type, thereby "inheriting" all of the base object's characteristics, including both properties and functions. Both interfaces and classes can use inheritance. An interface or class that is "inherited" from is known as the base interface, or base class, and the interface or class that does the inheritance is known as the derived interface, or derived class. TypeScript implements inheritance using the extends keyword.

Interface inheritance

As an example of interface inheritance, consider the following TypeScript code:

interface IBase { id: number; } interface IDerivedFromBase extends ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required