Why does first() rxjs operator keep returning array

Viewed 4059

I have a service with a function of type

getSummary(id: string, universe: string): Observable<INTsummary[]>

When I call this I only ever want the first item in the INTsummary[], so I'm trying to use rxjs first operator to do this:

  loadQuickSummary(){
    var obj = this.myService.getSummary(this.user.id, this.user.universe).first();
    console.log("getting quick summary");
    obj.subscribe(r => {
      console.log(`first value ${JSON.stringify(r)}`)
    })
  }

from reading docs and stackoverflow, this should return an object, but instead I get back an array of INTsummary's .

How can I get back just the first object in the INTsummary[] array?

2 Answers
Related