News for hackers. Stuff that matters.
Re:Playground Wisdom: Threads Beat Async/Await by ivanjermakov on Saturday November 23, 2024 @09:52AM (#42221205)
> I assume it could have been made implicit

Not quite. It gets ambiguous whether to wrap return or not. Example:

    function foo(): Promise<number> {
        if (...) { return Promise.resolve(5) }
        ...
    }
but async version is:

    async function foo(): Promise<number> {
        if (...) { return 5 }
        ...
    }
Although you can bake into the language one way or another.

There are no comments on this comment yet.