November 2018
Beginner
502 pages
10h 22m
English
Interfaces can contain method signatures as well. These won't contain the implementation of the method; they define the contracts for when interfaces are used in an implementation.
Let's look at an example:
interface OrderDetail { product: Product; quantity: number; getTotal(discount: number): number; }
Notice that the getTotal method on the interface doesn't specify anything about how the total is calculated – it just specifies the method signature that should be used.
Read now
Unlock full access