Skip to Main Content
Advanced TypeScript Programming Projects
book

Advanced TypeScript Programming Projects

by Peter O'Hanlon
July 2019
Intermediate to advanced content levelIntermediate to advanced
416 pages
10h 6m
English
Packt Publishing
Content preview from Advanced TypeScript Programming Projects

Writing our DiscogsClient class

When we write our DiscogsClient class, we already have the contract that it will be based on, along with the interface definition. This tells us that our class starts off like this:

public class DiscogsClient : IDiscogsClient{  public async Task<Results> GetByArtist(string artist)  {  }}

The definition of our class looks slightly different to our interface because we didn't have to say that GetByArtist was public or that the method was async. When we use async in a method declaration, we are setting a compilation expectation that the method will have the await keyword inside it. This should be very familiar to us from our TypeScript use of async/await.

When we call the Discogs API, it always starts off with the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn TypeScript 3 by Building Web Applications

Learn TypeScript 3 by Building Web Applications

Sebastien Dubois, Alexis Georges

Publisher Resources

ISBN: 9781789133042Supplemental Content