Optional area ( ? )
Makes a field optional.
Syntax
interface X { field?: type; }Description
If you put a ? after the field name, that area is not required.
Example
Loading editor…
Expected output
undefined
When to use?
Fields that don't always come (middle name, phone).