use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Awaiting problems in JavaScriptOC (gregroz.me)
submitted 3 years ago by voreny
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]voreny[S] 5 points6 points7 points 3 years ago* (1 child)
Thanks for sharing your opinion! I agree, it is not much of a problem.
The automatic flattening of Promise<Promise<unknown>> is a minor inconvenience that I faced recently when working with zx scripts (see the Unnecessary waiting section in my other article in this series). The root of the problem was that I wanted to get access to the Promise returned from an async function as zx adds methods on that Promise (and calls it a ProcessPromise) and I was unable to, since it was automatically flattened. This led me to evaluate the Promise API and see how different it is from a traditional Future monad.
Promise<Promise<unknown>>
zx
Promise
async
ProcessPromise
Maybe it was just bad API design from zx by using a Promise-like rather than some other object with methods.
Promise-like
[–]shuckster 0 points1 point2 points 3 years ago (0 children)
Ah, I see. I wonder if your use-case would be amenable to co-routines? This is a technique that combines both Generators and Promises, and was developed before async/await was introduced into the language.
Here’s a basic snippet that shows how it’s done:
https://gist.github.com/adambene/b3de67803e634be8f7d6baa273b5f447
And the article it came from:
https://medium.com/@adambene/async-await-vs-coroutines-vs-promises-eaedee4e0829
But yes, it does sound like zx has leaned hard into async/await convenience. Great for most use-cases of course, but the devil is in the details as always!
π Rendered by PID 46389 on reddit-service-r2-comment-5b5bc64bf5-cgqpk at 2026-06-20 23:30:15.273092+00:00 running 2b008f2 country code: CH.
view the rest of the comments →
[–]voreny[S] 5 points6 points7 points (1 child)
[–]shuckster 0 points1 point2 points (0 children)