All functions within a class adhere to the syntax and rules that we covered in the previous chapter on functions. As a refresher of these rules, all class functions can:
- Be strongly typed
- Use the any keyword to relax strong typing
- Have Optional parameters
- Have Default parameters
- Use argument arrays, or the rest parameter syntax
- Allow function callbacks and specify the function callback signature
- Allow function overloads
As an example of each of these rules, let's examine a class that has a number of different function signatures, and we will then discuss each one in detail, as follows:
class ComplexType implements IComplexType { id: number; name: string; constructor(idArg: number, nameArg: string); constructor(idArg: string, ...