title: How to fix Type Error not a function in angular
body: <p>Have a simple website choose your own adventure component. Get this error whenever I try to call the functions for the classes I made to represent story events.</p>
  
  <pre><code>export class ZombieCharacterOutcome {
      id: string;
      text: string;
      public characteristic: ZombiePlayerCharacteristic;
      events: string[];
  
      public getNextEvent(): string {
          var rand = Math.random() * this.events.length;
          return this.events[rand];
      }
  }
  </code></pre>
  
  <p>I am using a firestore database to store data, this is also how new outcomes are initialized.</p>
  
  <pre><code>getCharaterOutcome(outcomeID: string): Observable&lt;ZombieCharacterOutcome&gt; 
  {
      console.log(outcomeID);
      return this.db.doc('characterOutcomes/' + 
      outcomeID).snapshotChanges().pipe(map(choice =&gt; {
      const data = choice.payload.data() as ZombieCharacterOutcome;
      if (data) {
         data.id = choice.payload.id;
      }
      return data;
    }));
  }
  </code></pre>
  
  <p>And this is code from Angular Component being called on the front end...</p>
  
  <pre><code>nextEvent() {
      if(this.eventCount &lt; this.maxEvent) {
          this.characterService.getCharacterEvent(this.currentOutcome.getNextEvent()).subscribe(event =&gt; {
              this.currentOutcome = null;
              this.currentEvent = event;
              this.loadChoices();
          });
      } else {
          this.currentEvent = null;
          this.currentChoices = [];
          this.currentOutcome = null;
      }
  }
  </code></pre>
  
  <blockquote>
    <p>ERROR TypeError: this.currentOutcome.getNextEvent is not a function
        at ZombieCharacterComponentComponent.push../src/app/zombie-character-component/zombie-character-component.component.ts.ZombieCharacterComponentComponent.nextEvent (zombie-character-component.component.ts:60)
        at Object.eval [as handleEvent] (ZombieCharacterComponentComponent.html:28)
        at handleEvent (core.js:10251)
        at callWithDebugContext (core.js:11344)
        at Object.debugHandleEvent [as handleEvent] (core.js:11047)
        at dispatchEvent (core.js:7710)
        at core.js:8154
        at HTMLAnchorElement. (platform-browser.js:988)
        at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
        at Object.onInvokeTask (core.js:3811)</p>
  </blockquote>