Re: [whatwg/webidl] Add `async iterable<T>` type to WebIDL (PR #1397)

@saschanaz The interface can be distinguished from other objects because it is branded. A union of `interface` and `async iterable<T>` will always attempt to match the `interface` first. This is also why `dictionary` and `interface` are distinguishable.

Union resolution goes like this in this case: `MyInterface | MyDictionary | async iterable<T> (assuming V has been checked to be an object):

1. Check if `V` is an instance of the interface. _it's an interface_
2. Check if `V` has `[Symbol.asyncIterable]`. _it's an async iterable<T>_
3. _it's a dictionary_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1397#issuecomment-2233006080
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1397/c2233006080@github.com>

Received on Wednesday, 17 July 2024 10:47:09 UTC