February 2019
Beginner
694 pages
18h 4m
English
Interfaces, like classes, follow the same rules when dealing with functions. To update our IComplexType interface definition to match the ComplexType class definition, we need to write a function definition for each of the new functions, as follows:
interface IComplexType {
id: number;
name: string;
print(): string;
usingTheAnyKeyword(arg1: any): any;
usingOptionalParameters(optionalArg1?: number) : void;
usingDefaultParameters(defaultArg1?: number) : void;
usingRestSyntax(...argArray: number []) : void;
usingFunctionCallbacks(callback: (id: number) => string);
}
This interface definition includes the id and name properties and a print function. We then have a function signature for the usingTheAnyKeyword
Read now
Unlock full access