TypeScript
TypeScript DecoratorsTypeScript Decorators
Decorators attach special behavior to classes and functions.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
A Decorator is a special type of declaration that attaches extra features to a class or a function without changing its internal code. You often see them used heavily in popular frameworks like Angular or NestJS.
Example
Example
Key Points
- Decorators always start with the `@` symbol.
- They are an advanced, experimental TypeScript feature.
- You must enable them manually in the `tsconfig.json` file.
- They are essentially just functions that wrap other functions.