-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeFixedA PR has been merged for this issueA PR has been merged for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
TypeScript Version: 3.7.2 (playground)
Search Terms: generator implicitAny
Code
function* generator() {
const value = yield;
console.log(value);
}
const iterator = generator();
iterator.next();
iterator.next(5);
Expected behavior:
TypeScript Compiler with enabled noImplicitAny
flag warns about implicit any with yield expression assignment.
function* generator() {
const value: ExpectedType = yield call(fn); // Example from redux-saga
}
Actual behavior:
Yield expression is assigned implicitly as any
because we're not able to infer the type. While I acknowledge that proper type check here is a difficult issue with quite a few other issues open, we should be forced to declare the expected type.
Related Issues:
ExE-Boss
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeFixedA PR has been merged for this issueA PR has been merged for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone