- From: Hans Brende <notifications@github.com>
- Date: Fri, 05 Sep 2025 11:43:15 -0700
- To: whatwg/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 5 September 2025 18:43:19 UTC
HansBrende created an issue (whatwg/webidl#1522) ### What is the issue with the Web IDL Standard? For background, see the discussion here: https://gist.github.com/MattiasBuelens/496fc1d37adb50a733edd43853f2f60e In short, I noticed while trying to drop a polyfill for ReadableStream's async iteration into Typescript that the types weren't matching up with `AsyncIterator`. In short, the `return` method for async generators can accept a promise, rather than a plain value, which is awaited and unwrapped into the return value like so: `{done: true, value: resultOfAwaitedPromise}`. Whereas, the async iterator corresponding to the webidl spec seems to not do this, instead returning `{done: true, value: unawaitedPromise}`. To illustrate the discrepancy: ```typescript let gen = (async function*() {})(); await gen.return(Promise.resolve('foo')); // -> { done: true, value: 'foo' } let rs = new ReadableStream(); let it = rs.values(); await it.return(Promise.resolve('foo')); // -> { done: true, value: Promise {<fulfilled>: 'foo'} } ``` So I am curious if this is an oversight somewhere or intentional for some reason? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/webidl/issues/1522 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/webidl/issues/1522@github.com>
Received on Friday, 5 September 2025 18:43:19 UTC