diff --git a/packages/documentation/copy/en/handbook-v2/Classes.md b/packages/documentation/copy/en/handbook-v2/Classes.md index 4a520140d2e9..4b41e4d546b0 100644 --- a/packages/documentation/copy/en/handbook-v2/Classes.md +++ b/packages/documentation/copy/en/handbook-v2/Classes.md @@ -909,6 +909,38 @@ const MyHelperObject = { }; ``` +### Type-Checking Static Members of a Class + +Under the hood, each class is an object (really a function) with a prototype property. You can define a type for the class's static members, which will be properties of the class (not instances of it). + +```ts twoslash +interface VehicleType { + manufacturer: string +} + +interface VehicleTypeStatic { + readonly wheelCount: number; +} + +class Vehicle implements VehicleType { + readonly manufacturer: string; + + constructor(maker: string) { + this.manufacturer = maker; + } + + static readonly wheelCount = 4; +} + +const Mechanic = { + classHasFourWheels(value: VehicleTypeStatic) : boolean { + return value.wheelCount === 4; + } +}; + +Mechanic.classHasFourWheels(Vehicle); // returns true +``` + ## `static` Blocks in Classes Static blocks allow you to write a sequence of statements with their own scope that can access private fields within the containing class. This means that we can write initialization code with all the capabilities of writing statements, no leakage of variables, and full access to our class's internals.