Check out example codes for "ts interface optional parameter". It will help you in understanding the concepts better.

Code Example 1

interface Person {
    name: string;
    age: number;
    phone?: string;
}

let p: Person = {name: "Ashlee", age: 29};
console.log(p);

Learn ReactJs, React Native from akashmittal.com