DeliveryCustomer
Hierarchy (View Summary)
- Customer
- DeliveryCustomer
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
new DeliveryCustomer(
id: number,
name: string,
nextOrderNumber: string | number,
subscriptionType: "basic" | "enterprise",
): DeliveryCustomerThe constructor of the DeliveryCustomer class.
Parameters
id: numberthe customer's database ID
name: stringthe customer's name
nextOrderNumber: string | numberthe next number to use when this customer places an order
subscriptionType: "basic" | "enterprise"whether this customer has a basic or enterprise subscription
Returns DeliveryCustomer
Properties
Readonlyid
A public readonly property.
name
A public property that can be reassigned.
Protected Optionalcontact Name
An optional protected property.
Optionalpreferred Courier Id
A property defined on the subclass.
Readonlysubscription Type
Another property defined on the subclass.
Accessors
next Order Number
- get nextOrderNumber(): string
A getter that prepends a number sign to the private
_nextOrderNumberproperty.Returns string
- set nextOrderNumber(value: string | number): void
A setter that takes in either a string or a number and sets the private
_nextOrderNumberproperty.Parameters
value: string | number
Returns void
Methods
on Order Placed
onOrderPlaced(): voidA public method. To be called when an order is placed for this customer.
Returns void
on Order Placed Arrow Function
onOrderPlacedArrowFunction(): voidA public method that's defined using an arrow function.
TypeDoc knows to document this as a method rather than a property.
Returns void
Protectedis Valid
isValid(): booleanAn example of overriding a protected method.
A DeliveryCustomer can only have a preferred courier if its
subscription type is enterprise.
A class that extends
Customer.Notice how TypeDoc shows the inheritance hierarchy for our class.