No contextual typing on yield expression when generator function is contextually typed as union of normal function and generator function #45596
Labels
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
π Search Terms
generator function union contextual typing yield
π Version & Regression Information
4.1.5, 4.4.2
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
A noImplicitAny error is reported.
Note: the same happens for async generator functions too.
π Expected behavior
Type of
num
is inferred asnumber
. This is the behavior of TS 4.0.The text was updated successfully, but these errors were encountered: