Class decorators

With decorator functions, you can take complete control over how a class declaration works. Notice in the example below that the classDecorator function is called before any instances of the class are created.

Loading TypeScript...

A common pattern for using decorators is to provide a decorator factory function, which produces a function whose type matches the global utility type ClassDecorator.

Loading TypeScript...

Was this page helpful?