"TypeScript classes are JavaScript classes with type checking. Same syntax, more guarantees."
The basic shape
A TypeScript class declaration is JavaScript class syntax with type annotations on fields, parameters, and return types. Class fields are declared with names and types; the constructor initializes them; methods read and modify the fields; the class instance shape carries all of this through the type system.
class Counter {
count: number = 0;
increment(): void { this.count++ }
reset(): void { this.count = 0 }
}
The count: number = 0 is field declaration plus initialization. The methods access this.count — TypeScript knows this is a Counter inside the methods, so the type is preserved.
Class instance type
A class declaration creates both a constructor (the value Counter) and a type (the type Counter). const c: Counter = new Counter() uses the type; new Counter() calls the constructor. The two share the same name and most TypeScript code mixes them freely.
Getters and setters
Class methods can use get and set keywords to make property-like accessors. get name(): string declares a getter; reading instance.name calls it. set name(v: string) declares a setter; assigning to instance.name = '...' calls it. From outside the class, the accessor looks like a property; inside, it's two methods.