- From: Luca Casonato <notifications@github.com>
- Date: Mon, 26 Aug 2024 02:45:59 -0700
- To: whatwg/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 26 August 2024 09:46:03 UTC
So during an experiment we ran for `new Response(async iterable<Uint8Array>)`, we discovered [another fun edge case](https://github.com/whatwg/fetch/issues/1291#issuecomment-2309773461) to think about: when having a union of `string | async iterable<Uint8Array>`, what should a boxed string resolve as? In the current spec text it resolves as a `async iterable<DOMString>`, which would cause an error during iteration. This happens because the boxed string is both an object, and has a `[Symbol.iterator]` method. We have two options here: 1. handle this case specially in WebIDL by banning boxed string as a value for `async iterable`, like we do with primitives (kinda weird, but means this doesn't become a weird edge case only in fetch and is instead uniform across the platform) 2. handle this as a weird edge case in `fetch`, and in the future in any other `string | async iterator` WebIDL unions. The big question is whether, assuming `ReadableStream.from("asd")` throws, `ReadableStream.from(new String("asd"))` should throw, or create a stream of string chunks. Any thoughts? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/webidl/pull/1397#issuecomment-2309798759 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/webidl/pull/1397/c2309798759@github.com>
Received on Monday, 26 August 2024 09:46:03 UTC