-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yield expressions should be able to acquire the type of generator return types #10509
Comments
I guess in the face of overloads, we could take the union of all the types of the first parameters, subbing in |
Can I ask what's the use case/scenario for this? The only common scenario I know of where On the other hand, iterables for use in |
This issue is largely to track user feedback on whether this is desired, or to at least point to some conversation about the idea. 😄 |
is not this the same as #2983 but for generators? |
TL;DR: this is a duplicate of #2983 and should be closedI believe this is indeed a duplicate of #2983, which discusses solving (among others) the problem where:
(I don't know what @mhegazy meant by "but for generators", #2983 is all about generators as far as I can tell.) |
A (much fancier) version of this might be usable to make accurate type definitions for For |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
Courtesy of @bterlson (and his idea in general)
This type is basically an
IterableIterator
except that it restricts the types of values a consumer can pass through tonext
.Here, calls to
next
can only acceptnumber
s; however, the yield expressions in the generator are just typed asany
.Since we have an explicit type, we should just figure the type of
yield
expressions out from that.The text was updated successfully, but these errors were encountered: