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:
xxxxxxxxxx
1
class Square {
2
3
get name(): string {
4
return 'Square';
5
}
6
7
public computePerimeter(aSize: number, bSize: number): number {
8
return 2 * aSize + 2 * bSize;
9
}
10
11
public computeArea(aSize: number, bSize: number): number {
12
return aSize * bSize;
13
}
14
15
public toString(): string {
16
return `[ ${this.name} object ]`;
17
}
18
}