TypeScript Syntax

static — class-side members

Static fields and methods belong to the class constructor rather than individual instances. Access them through the class (or appropriate subclass). A generic class static member cannot refer to the class type parameter because that parameter describes the instance side. Observed output: '4'. Local verification: TypeScript 5.8.3, strict mode, ES2022, CommonJS, Node.js 22.16.0. Disposable library declarations are enabled for the fixture suite.

Formal Syntax & Structure

typescript syntaxtypescript
class C { static value = expression; }

Working Example

Example Snippettypescript
class Counter { static total = 4; }console.log(Counter.total);
TypeScript Reference