In TypeScript, to make all attributes optional in an interface, you can simply add a ? after each attribute name.
index.ts101 chars6 lines
This will allow instances of ExampleInterface to be created without providing any attribute values.
If you want some attributes to be required and some to be optional, you can omit the ? for the required attributes.
index.ts99 chars6 linesIn this example, attribute1 and attribute3 are required, while attribute2 is optional.
gistlibby LogSnag