To enable decorators in TypeScript, developers first have to enable the option of experimentalDecorators via command line or tsconfig.json.

Here is the command line to use.
  • $tsc --target ES5 --experimentalDecorators
  • For tsconfig.json, use the following syntax.
    {
       "compilerOptions": {
          "target": "ES5",
          "experimentalDecorators": true
       }
    }
BY Best Interview Question ON 05 Mar 2020