Optional fields in TS Interface
Devmnj • Sat Jun 19 2021
0 min read
Optional member in a TypeScript interface is the one that is not a mandatory field. We can skip those field while assigning values, everything else is mandatory.
To create a optional member we can use ? in front of the member and before the type.
Source code
..
firstName: string;
lastName?: string;
..