-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Type Iterator#next() argument (yield expression) #32998
Comments
And actually, Iterator has additional problems, like To be more concrete, the types should be interface Iterator<T> {
next(): IteratorResult<T>;
}
interface Generator<A, B> extends Iterator<B> {
next(value?: A): IteratorResult<B>;
return<T>(value?: T): IteratorResult<T>;
throw(e?: any): IteratorResult<B>;
} The optional argument is problematic for having non-undefined values inside the generator, but I don't have a better suggestion. |
I think you should take a look at the TS 3.6 release notes |
See #30790 and its linked issues |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Excellent, thanks @AlCalzone for linking to the 3.6 RC notes. @typescript-bot I think you might not be working correctly (you didn't actually close). |
Search Terms
Iterator.next() type, yield expression type
Suggestion
Type
Iterator.next()
/yield
. I suggest Iterator<A, B>, whereA
is the input type, andB
is the output type.Mentioned in #10148 and #14883.
Required by #32283.
Alternative proposal in #32523, those this requires more drastic changes to TypeScript's type model.
Use Cases
Pretty self-explanatory; I want typed expressions. It's why I use TypeScript.
And currently, all
yield ...
expressions have no typing. (They are typed asany
).Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: