THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.
Typescript introduced decorators, Decorators are one of the design patterns in an object-oriented program.
Design patterns are solutions to repeated problems. This pattern allows adding functions and behavior to objects dynamically. It does affect the overall behavior of objects of a class.
Typescript decorators can be applied to
These are experimental features, This might change in future versions. This will not be available to code normally.
We have to do Compiler configurations - experimentalDecorators to enable it.
It is done via the command line or tsconfig.json.
tsc --target ES5 --experimentalDecorators
{
"compilerOptions": {
"target": "ES5",
"experimentalDecorators": true
}
}
We will see the decorator examples in future posts
Class Decorator and Examples
🧮 Tags
Recent posts
Naming style camel,snake,kebab,pascal cases tutorial example javascript Add padding, leading zero to a string number How to Display JavaScript object with examples How to convert decimal to/from a hexadecimal number in javascript How to convert character to/from keycode in javascript examplesRelated posts