Skip to content

Strange 2488 error involving overload resolution and this parameter type #60374

Description

@yume-chan

🔎 Search Terms

yield ts2488 never iterator

🕗 Version & Regression Information

  • This changed between versions 3.5.1 and 3.6.2

every-ts bisect gives: e8bf958 is the first bad commit

⏯ Playground Link

https://www.typescriptlang.org/play/?module=1&ts=5.7.0-dev.20241030#code/CYUwxgNghgTiAEAzArgOzAFwJYHtVNQB4AVAPgAoA3KCZEALnnIEp4BeU+Y5xgbyZ5d4AXwDcAKFCRYCFOmx4CJCtVoMuggJIYQMKACMIIQmgDWqHAHdUpCeJAAPAA44YGeNIDOn+AEF4vOLwwfBQ7ATkcpi4qABUTBgAFliejL6sgSFZ8ACeWCAQwPGIqOQAjMwSWcKV4kEh+uElkWjRePHkSSlpGfXZHnie7joAtk5NpRVV-bn5hfGjTtPBNRLC4kA

💻 Code

declarefunctionfn<T>(value: ()=>T): {(): T};declarefunctionfn<T>(value: T): Iterable<unknown>;exportclassA{a=fn(function*(this: A){yield*fn(1);// error});b=fn(function*(this: A){consttemp=fn(1);// okyield*temp;});}

🙁 Actual behavior

src/error.ts:6:16 - error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator.
6 yield* fn(1);
~~~~~

🙂 Expected behavior

No error, as in A.b

Additional information about the issue

No response

Metadata

Metadata

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions