by peferron · 3y ago · 0 comments
If there are `await` keywords previously in the function, then the line you're looking at will run after these async calls are done. Otherwise it'll run ASAP. Is there something else to it?
const example = async () => {
const ifError = Promise.reject("something went wrong")
const value = await someOtherPromise()
await (valueIsOk(value) ? runNextStep(value) : ifError)
}
will always throw.Is the concern you're raising that people may accidentally orphan floating promises? That can be addressed with linter rules. [1][2]
[1]: https://github.com/typescript-eslint/typescript-eslint/blob/...
[2]: https://github.com/typescript-eslint/typescript-eslint/blob/...