November 2018
Beginner
502 pages
10h 22m
English
We might want to make a property optional because not every situation where the interface is implemented requires it. Let's take the following steps in our OrderDetail interface:
interface OrderDetail { product: Product; quantity: number; dateAdded?: Date, getTotal(discount: number): number;}
We'll see that our implementation of this interface, tableOrder, isn't broken. We can choose to add dateAdded to tableOrder but it isn't required.
Read now
Unlock full access