# When should I `await`? --- I recommend taking a look at the [MDN documentation on async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) for a great explanation of how `async/await` works and when you should use it. ## A slightly worse explanation `async/await` in Javascript is really just syntactical sugar for writing Promises. When you see an `await` you can just pretend that everything after that line is wrapped in a `then` clause if that makes it easier to think about. Say you have: ```ts await functionThatReturnsAPromise(); console.log('called after await'); ``` That's the equivalent of: ```ts functionThatReturnsAPromise().then(() => { console.log('called after await'); }); ``` ### Recommendation: Always add return types to function type definitions When dealing with async functions, it's easy to get tripped up and think you have a string but really you have a `Promise<string>`. ```ts async function myFunction() { const myString = await fetchTheBestSuperhero(); // Promise.resolve("Spider-Man"); return myString; // "Spider-Man" } ``` I'm returning a string from this function, right? Wrong. You're returning `Promise<string>`. So update your function declaration to be: ``` async function myFunction(): Promise<string> { ... } ``` I recommend using a linter like [eslint](https://eslint.org/). to keep you honest and force you to write return types for all your functions.