Check out example codes for "angular make variable optional". It will help you in understanding the concepts better.

Code Example 1

export interface User {
    id: number;
    name?: string; // interfaces allow fields to be optional
}

Learn ReactJs, React Native from akashmittal.com