Add BuiltInIterableIterator for built-in iterables with undefined return values#56517
Add BuiltInIterableIterator for built-in iterables with undefined return values#56517lionel-rowe wants to merge 1 commit intomicrosoft:mainfrom
BuiltInIterableIterator for built-in iterables with undefined return values#56517Conversation
|
Maybe the name |
Yeah, it'd be worth considering alternatives for the name. Some other possibles, per #52998 (comment):
Personally I prefer the nomenclature "implicit return" over "no return", because the latter could also refer to a non-terminating function/generator ( However, bikeshedding about names may be premature — per #52998 (comment), this will likely remain blocked pending #36239, unless someone smarter than me can see a non-breaking way forward. |
|
To preserve backwards compatibility, in #58243 we've opted to introduce a strict-mode flag to control the expected return type for a built-in iterator. We've also adopted There is a slight conflation of terms here, however. #58222 introduces |
Fixes #52998
Adds
BuiltInIterableIterator, a stricter version ofIterableIteratorwhich is adhered to by all built-in iterables. This ensures correct types fornext().valueand for the return value ofyield*:IterableIteratorstill remains, and should probably be preferred for usage as a parameter type to maintain backward compatibility and to allow lenience where the return value is discarded.Currently out of scope for this PR: corresponding changes to DOM libs; any equivalent changes to async iterables.