content
content copied to clipboard
Atomics.waitAsync() return type is wrong
MDN URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync
What specific section or headline is this issue about?
What information was incorrect, unhelpful, or incomplete?
A Promise that resolves to one of the following result objects:
{ async: false, value: 'ok' } { async: false, value: 'not-equal' } { async: false, value: 'timed-out' } { async: true, value: promise }
What did you expect to see?
From the current proposal, the result is an object, not a promise—i.e. if async: false, it actually operates synchronously. Also, "ok" should be part of the promise, not a string.
The result should look like this:
type Result =
| { async: false; value: "not-equal" | "timed-out" }
| { async: true; value: Promise<"ok" | "timed-out"> };
Do you have any supporting links, references, or citations?
https://github.com/tc39/proposal-atomics-wait-async/blob/master/PROPOSAL.md
Do you have anything more you want to share?
No response
MDN metadata
Page report details
- Folder:
en-us/web/javascript/reference/global_objects/atomics/waitasync - MDN URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/waitAsync
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/javascript/reference/global_objects/atomics/waitasync/index.md
- Last commit: https://github.com/mdn/content/commit/27e11bf5ee2425dc6b939d0d1825ac741414a688
- Document last modified: 2022-07-23T09:11:31.000Z