TypeScriptSyntax
Optional Property
Code example
interface User {
email?: string;
}Marks an object property as optional.
In TypeScript, optional property: marks an object property as optional — interface User { email?: string; }
interface User {
email?: string;
}interface User {
email?: string;
}Marks an object property as optional.
Use interface User { email?: string; }.
Use this pattern: interface User { email?: string; }
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.