title: Babel's TypeScript parsing is not consistent
body: <p>I tried the following Angular component code (in TypeScript) in <a href="https://astexplorer.net/" rel="nofollow noreferrer">ASTExplorer</a> by choosing <code>babylon7-7.0.0-beta.12</code> and <code>babelv7-7.0.0-alpha.12</code> and it parses, transforms and produces the exact output:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  
  @Component({
    selector: 'app-list',
    templateUrl: './list.component.html',
    styleUrls: ['./list.component.css']
  })
  export class ListComponent implements OnInit {
  
    data: [
      'Item 1',
      'Item 2',
      'Item 3',
      'Item 4',
      'Item 5'
    ];
  
    constructor() { }
  
    ngOnInit() {
    }
  
  }
  </code></pre>
  
  <p>However, when I try to parse and transform the same code with same version of Babel and Babylon using Babel's <code>transformFileSync</code> API, I get the following error:</p>
  
  <pre><code>This experimental syntax requires enabling one of the following parser plugin(s): 'decorators, decorators2' (3:0)
    1 | import { Component, OnInit } from '@angular/core';
    2 | 
  &gt; 3 | @Component({
      | ^
  </code></pre>
  
  <p>So, I passed the following plugins to the API (as there were more errors):</p>
  
  <pre><code>plugins: [
              ['transform-decorators-legacy'],
              ['transform-typescript'],
              ['transform-class-properties']
  ]
  </code></pre>
  
  <p>But, this produces an output which is very different from the input code:</p>
  
  <pre><code>var _dec, _class;
  
  import { Component } from '@angular/core';
  export let ListComponent = (_dec = Component({
    selector: 'app-list',
    templateUrl: './list.component.html',
    styleUrls: ['./list.component.css']
  }), _dec(_class = class ListComponent {
    constructor() {
      this.data = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5'];
    }
  
    ngOnInit() {}
  
  }) || _class);
  </code></pre>
  
  <p>Would appreciate your help on identifying the root cause so that I am able to parse Angular TypeScript code and build my further transformation logic.</p>