title: Angular: map string array to array of enum values in http get call
body: <p>I have an enumeration in my typescript code, which lists all possible user roles:</p>
  
  <pre><code>enum UserRole {
      CONSULTANT,
      MANAGER,
      ...
  }
  </code></pre>
  
  <p>And I have a REST endpoint <code>/users/id/roles</code> that returns array of strings representing roles of a particular user:</p>
  
  <pre><code>[
      "CONSULTANT",
      "MANAGER",
      ...
  ]
  </code></pre>
  
  <p>Now I want to map this array in my frontend code. I tied doing it like this:</p>
  
  <pre><code>import {Http} from '@angular/http';
  import {Observable} from "rxjs/Observable";
  import {plainToClass} from "class-transformer";
  ...
  
  getUserRoles(id: string): Observable&lt;UserRole[]&gt; {
      return this.http.get(`/users/${id}/roles`)
          .map(responce =&gt; plainToClass(UserRole, responce.json()));
  }
  </code></pre>
  
  <p>But I get:</p>
  
  <blockquote>
    <p>error TS2345: Argument of type 'typeof UserRole' is not assignable to parameter of type 'ClassType'.
      Type 'typeof UserRole' provides no match for the signature 'new (...args: any[]): UserRole[]'.</p>
  </blockquote>
  
  <p><strong>Q:</strong> Is there any way to convert string-array to array of enum elements?</p>
  
  <p><strong>Note:</strong> Im using Typescript 2.5.3. in pair with Angular 5.0.5.</p>