- In JavaScript, we can apply decorators to class fields, methods, and the entire class. Therefore, we can’t use decorators on plain objects. They only work with classes.
- Decorators are not a standard JavaScript feature. They are in stage 3 of the ECMA TC39 specification phase. To use JavaScript Decorators we need to set up a transpiler tool in our development environment, like Babel.
- Decorator is concept and can be in form of function or start with
@
.
There are function decorator and class and it's member decorator. Fot indepenedent/global function we can decorate it by wrapping it inside another function but for class decorator we can use the @
symbol and typescript or bable library.