Search Terms
Iterator.next() type, yield expression type
Suggestion
Type Iterator.next()/yield. I suggest Iterator<A, B>, where A is the input type, and B 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 as any).
Examples
function*totalLength(){letresult=0;while(true){result+=(yieldresult).length;}constt=totalLength();t.next('abc');// 0t.next('def');// 3t.return('');// 6Checklist
My suggestion meets these guidelines:
Search Terms
Iterator.next() type, yield expression type
Suggestion
Type
Iterator.next()/yield. I suggest Iterator<A, B>, whereAis the input type, andBis 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: