EN
TypeScript - class naming convention
24
points
This article explains the rules for class naming convention used in TypeScript.
The class naming convention defines the following rules:
- Use PascalCase for class names.
- Use camelCase for class members.
- Use whole words in names when possible.
Class naming convention example:
class Square {
get name(): string {
return 'Square';
}
public computePerimeter(aSize: number, bSize: number): number {
return 2 * aSize + 2 * bSize;
}
public computeArea(aSize: number, bSize: number): number {
return aSize * bSize;
}
public toString(): string {
return `[ ${this.name} object ]`;
}
}