Grokking TypeScript
Vote

0% completed

​

Implementing Interfaces in Classes

Adding implements to a class changes nothing in the class itself. It adds no properties, no methods, and no JavaScript code. It only asks the compiler to check that the class has the shape an interface describes, and to report any difference at the class.

An earlier chapter introduced interfaces as descriptions of an object's shape. A class can promise to follow such a description, and the rest of this page shows what the compiler checks, and what it leaves unchecked, once a class makes that promise.

Implementing an Interface

Suppose a checkout accepts different ways to pay

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content