title: Typescript - Code fails to build from error TS1128: Declaration or Statement expected, but runs as expected when I serve the code
body: <p>I am developing an Angular2 project, and I created a class that serves as my main Component class:</p>
  
  <pre><code>import { Component, OnInit} from '@angular/core';
  
  import { submitService } from './Common-functions/submit.service';
  
  @Component({
  selector: 'my-app',
  template: `htmlCode`
  
  })
  export class AppComponent implements OnInit{ 
    hideTable = true;
    lengthOfRecords = 0;
    lowerLimit = 0;
    upperLimit = 5;
    prevButtonDisabled = true;
    nextButtonDisabled = false;
  
    //User inputs
  
  constructor(private sService:submitService) { }
  
  ngOnInit() {
      public submitToJSON() {
  
           //SumbitJSON Object
              var submitJSON = {
                  //inputData 
                       };
  
              this.sService.POST(submitJSON);
       }
  
  
     public returnDetails() {
  
      this.listOfIDs = {//ListData};
  
              this.hideTable = false;
          var keys = Object.keys(this.listOfIDs);
              var len = keys.length;
              this.lengthOfRecords = len;
          }
  
      public prev() {
              if(this.lowerLimit &lt;= 0) {
                  ;
                  }
              else {
                  this.lowerLimit = this.lowerLimit - 6;
                  this.upperLimit = this.upperLimit - 5;
                  this.nextButtonDisabled = false;
                  if(this.lowerLimit &lt;= 0) {
                      this.prevButtonDisabled = true;
                      }
                  }
              }
     public next() {
              if(this.upperLimit &gt;= this.lengthOfRecords) {
                  ;
                  }
              else {
                  this.lowerLimit = this.lowerLimit + 6;
                  this.upperLimit = this.upperLimit + 5;
                  this.prevButtonDisabled = false;
                  if(this.upperLimit &gt;= this.lengthOfRecords) {
                      this.nextButtonDisabled = true;
                      }
                  }
              }
  
   getEntries(obj, from, to) {
          if(obj!=null) {
              var entries = [];
              for(var key in obj) {
                  // extract index after `app`
                  var index = key.substring(3);
                  if(index &gt;= from &amp;&amp; index &lt;= to) {
                      entries.push( obj[key]);
                  }
              }
              return entries;
              }
  
   }
  
  }
  </code></pre>
  
  <p>When I run npm start (which will run tsc -p ./), I get the following two errors:</p>
  
  <pre><code>app.appComponent.ts: error TS1128:Declaration or statement expected
  app.appComponent.ts: error TS1128:Declaration or statement expected
  </code></pre>
  
  <p>At the following lines of code</p>
  
  <pre><code>---&gt; public submitToJSON() {
  
       //SumbitJSON Object
          var submitJSON = {
              //inputData };
  
          this.sService.POST(submitJSON);
   }
  </code></pre>
  
  <p>And at the last line of the code.  I have been modifying the code the whole day, and only removing the OnInit related code fixes it.  What am I doing wrong?  I'm new to Angular2, so any information would be helpful.  I am also running tsc version 3.1</p>