title: Don't know how to implement an enum using an interface in an angular2 class
body: <p>Going around in circles here. Very new to Typescript and it's causing major headaches with trivial implementations.</p>
  
  <p>How do a define in <code>AgentStatusService</code> that it should have an array of 4 options called <code>['offline','available','busy','away']</code> ? AgentStatus is defined ( or is it? ) and I am injecting it into the <code>AgentStatusService</code>.</p>
  
  <p>Microsoft Visual Studio Code is barfing on line 21 where the type 'typeof AgentStatus' is not assignable to type 'AgentStatus'... why?</p>
  
  <p><strong>Updated:</strong></p>
  
  <pre><code>import { EventEmitter, Injectable } from '@angular/core';
  
  export enum AgentStatus {
      available =1 ,
      busy = 2,
      away = 3,
      offline = 0
  }
  
  export interface IAgentStatusService {
      state: number
      states: AgentStatus
  }
  @Injectable()
  export class AgentStatusService implements IAgentStatusService {
  
      state:number;  // this really should be string, but line 22 returns a number
      states:AgentStatus;
  
      constructor(states:typeof AgentStatus = AgentStatus){
          // unreacheable code browser_adapter.ts:78EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot read property 'isSkipSelf' of null
          // absolutely impossible to debug...
          this.state = AgentStatus.offline // this returns a number
      }
  
      //   set state(state:string){
      //       try{
      //       this._state = this.states[state];
      //       // string 
  
  
      //       } catch(e){
      //           console.log('tried setting bad enum value on AgentStatus', e.stack);
      //       }
      //   }
  
      //   get state():string{
      //       return this._state; 
      //   }
  
      //   get model():any {
      //     return this.states;    
      //   }
  }
  </code></pre>
  
  <p><strong>Compare with</strong> 
  This implementation satisfies angular2:</p>
  
  <pre><code>@Injectable()
  export class AgentStatusService {
      public states = ['offline','available','busy','away'];
      private _state;
  
      constructor(){
          this._state = this.states[0];
      }
  
      set state(state:string){
          try{
          this._state = this.states[state];
          } catch(e){
              console.log('tried setting bad enum value on AgentStatus', e.stack);
          }
      }
  
      get state():string{
          return this._state; 
      }
  
      get model():any {
          return this.states;    
      }
  }
  </code></pre>