What is the benefit of prepending async to a function that returns a promise?

The only benefit of async is as a visual marker that the function will (always) return a promise, and you don’t even have to scan the function body for the return statement. It might be useful for consistency if you have a row of async functions.

Apart from that: there’s absolutely zero benefit from it. It’s as good as wrapping the return value in an additional Promise.resolve() call. If your function body only consists of a return statement with a promise (either a new Promise or another function call), I recommend not to use async.

In general, if your function body does not contain an await expression, you probably don’t need the async keyword either. The exception from the rule is when you want to make sure that the function always returns a promise, even if there’s an exception raised in the code which should lead to a promise rejection.

Leave a Comment