title: Angular 2 and TypeScript Promise return array
body: <p>I am trying to return an array from a service using Promise.Then. The function is my service is follow:</p>
  
  <pre><code>userList: Users[] = [];
  
  getUsers = {
      userList: (): Promise&lt;Users[]&gt; =&gt; {
          let headers = new Headers();
          headers.append('Content-Type', 'application/x-www-form-urlencoded');
          headers.append('Authorization', 'Bearer ' + this.authenticationService.token);
          return this.http.get(this.authenticationService.url + '/tournament/getGames', {
              headers: headers
          }).map((response: Response) =&gt; {
              var status = response.json().status;
              console.log(response.json().status);
              if (status) {                   
                  this.userList = response.json().users;
                  console.info(response.json().users);
                  return this.userList;
              }
              else {
                  return null;
              }
          }).toPromise();
  
      }
  }
  </code></pre>
  
  <p>then I am using this in administrator.component.ts to get the Users list:</p>
  
  <pre><code>usersList: Users[] = [];
  </code></pre>
  
  <p>inside ngOnInit:</p>
  
  <pre><code>this.getData().then(() =&gt; this.isDataAvailable = true);
  </code></pre>
  
  <p>getData function:</p>
  
  <pre><code> getData(): Promise&lt;Users[]&gt; {
      return this.UserService.getUsers().then(users =&gt; {
          this.usersList= users;
          console.log(this.usersList);
      });
  }
  </code></pre>
  
  <p>and the code is returning this error message:</p>
  
  <p><em>cannot invoke an expression whose type lacks a call signature</em></p>
  
  <p>Any help is much appreciated as I use a similar logic in a different component.</p>