As discussed in this post, the optional ?
operator is commonly used to indicate that a function parameter can be omitted. But what is the significance of the ?
operator when it appears on interface parameters? For instance, consider the following TypeScript interface:
export interface Person {
phone?: number;
name?: string;
}
Suppose there is a class that implements this interface:
class Customer implements Person {
}
Is the implementation of Person
correctly done by Customer
simply because all properties from the Person
interface are marked as optional?