getBooks(): Observable<Array<Books>> {
return this.http
.get<{ items: Books[] }>(
'https://www.googleapis.com/books/v1/volumes?maxResults=5&orderBy=relevance&q=oliver%20sacks'
)
.pipe(map((books) => books.items || []));
}
Trying to understand the TypeScript syntax here:
.get<{ items: Books[] }>(
Does this mean that first it gets the URL and does a map
filter operator on it, then it’s returning an object that only contains an items
property with the interface Books[]
?