DEV Community

Discussion on: An async/await gotcha

 
tyrw profile image
Tyler Warnock • Edited

We're not actively going through the codebase and replacing things, but we are able to eliminate a lot of extra scoping and syntax by using async/await as we make changes or add new features.

For example if you want to use the result of a promise several .then calls later, you have to either nest your promises or use a scope variable. With async/await you don't, so it has a nicer tidiness factor.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

Agreed promises if used in a certain way, can cause a form of callback hell. How many promises are there in your codebase. 35000 lines doesn't really explain the size of it. To clarify I have been using async await way back when they dropped in typescript last year. I love them.

Thread Thread
 
tyrw profile image
Tyler Warnock

How many promises are there in your codebase

Lots of them, maybe 5-10k?

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

Jeez well if it make your codebase cleaner, I can see why now. Thanks for sharing the post 😀.