2 ms·
> But then you can't know, as the caller, whether any function has "sometimes this function just never returns" semantics without inspecting the whole call chai
by dragonwriter 2y ago
> But then you can't know, as the caller, whether any function has "sometimes this function just never returns" semantics without inspecting the whole call chain of every function you call (an arguably impossible task), and that's worse.
You have exactly as much guarantee of this with async functions as with sync ones, though, but if there is a reason to worry about an async function where it is being called from a sync function and you need to provide a better guarantee, Promise.race() it with a timeout and...problem solved.