// Await-ing promises within functions is OK if you don't return anything
await Promise.resolve();
// These will cause background tasks to stop executing immediately
return 1; // OK: returning a value
return await Promise.resolve(); // WRONG: returning the result of a promise
return await Promise.reject(); // WRONG: same behavior as resolved promises
// These will wait until the related background task finishes
return Promise.resolve(); // OK: returning the promise itself
return Promise.reject(); // OK: same behavior as to-be-resolved promises