title: ts2304 cannot find name 'OnInit'
body: <p>I've worked through the Angular superhero tutorial. It all works. </p>
  
  <p>If i close the cmd window running NPM, then re-open a CMD window and reissue the NPM START command I get two errors </p>
  
  <pre><code>src/app/DashBoard.component.ts(12,44)  TS2304 : Cannot find name 'OnInit'.
  src/app/hero-list.component.ts(16, 434)  TS2304 : Cannot find name 'OnInit'.
  </code></pre>
  
  <p>I can resolve this by removing </p>
  
  <pre><code>Implements OnInit
  </code></pre>
  
  <p>from both these classes, 
  run NPM start 
  re-add them  (simply CTL Z in the editor)
  make some change , save. 
  The app recompiles and I am off and running.</p>
  
  <p>I have 4 classes that implement this function. I have studied them and can not figure out what makes 2 fail...</p>
  
  <p>I have read posts that reference TS2304, but this seems to be a generic Function/Variable/Symbol not found message ...</p>
  
  <p>I don't know what to post. I'm happy to post any of the code.<br>
  Is this caused by errors in modules this depends on (hero.ts)? </p>
  
  <p>Here is one class that is failing in this manner. 
  This is the hero-list.component.ts file
  (at various points in the demo/online examples, this is also named Heroes.component..)</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { Router } from '@angular/router';
  
  import { Hero  } from './hero';
  import { HeroService  } from './hero.service';
  
  @Component({
    selector: 'hero-list',
    templateUrl: './hero-list.component.html' ,
    providers: [HeroService],
    styleUrls: [ './hero-list.component.css']
  })
  
  
  
  export class HeroListComponent implements OnInit   {
  
      heroes : Hero[];
      selectedHero: Hero;
  
      constructor(
          private router : Router ,
          private heroService: HeroService
          ) { }
  
      ngOnInit(): void {
          this.getHeroes();
      }
  
      onSelect(hero: Hero): void {
          this.selectedHero = hero;
      }
  
      getHeroes(): void {
          this.heroService.getHeroes().then(heroes =&gt; this.heroes = heroes);
      }
  
      gotoDetail() {
          this.router.navigate(['/detail', this.selectedHero.id]);
      }
  
      add(name: string): void {
          name = name.trim();
          if (!name) { return; }
          this.heroService.create(name)
              .then(hero =&gt; {
                  this.heroes.push(hero);
                  this.selectedHero = null;
              });
      }
      delete(hero: Hero): void {
          this.heroService
              .delete(hero.id)
              .then(() =&gt; {
                  this.heroes = this.heroes.filter(h =&gt; h !== hero);
                  if (this.selectedHero === hero) { this.selectedHero = null; }
              });
      }
  }
  </code></pre>