Closed
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: