Execute Promises in Parallel and Serial using async / await

Share this video with your friends

Send Tweet

The great thing about asynchronous programming is that you can do multiple things in parallel. E.g. you can make multiple network requests, or read multiple files from the file system.

This lesson covers how to write parallel as well as serial async code.

Marcell Ciszek
Marcell Ciszek
~ 4 years ago

Hi Basarat, Great course ! I just wonder how would I type the people object properly in the getUserDetails.ts file ? I created an interface like this interface Person { name: string; location: string; }

But don't really know how to type an Object that contains objects in Typescript.

Thank you !

Basarat Ali Syed
Basarat Ali Syed(instructor)
~ 4 years ago

You need an index signature: https://basarat.gitbook.io/typescript/type-system/index-signatures

interface Person { name: string; location: string; }
interface Persons { [person: string]: Person; }
Marcell Ciszek
Marcell Ciszek
~ 4 years ago

Thank you @Basarat, really appreciate the help :)