Microsoft/TypeScript
View on GitHubNo report of implicit any type in a generator when destructuring
Open
#43,172 opened on Mar 10, 2021
BugDomain: check: Type InferenceHelp Wanted
Description
Bug Report
๐ Search Terms
no implicit any, generator, yield, destructure #41348 - Report implicit any error for 'yield' result with no contextual type
๐ Version & Regression Information
TypeScript 4.2.3
โฏ Playground Link
Playground link with relevant code
๐ป Code
function* sample() {
const a = yield 1 // error, as expected, a is implicitly any
const { b } = yield 1 // no error, but expected, b is implicitly any
const [c] = yield 1 // no error, but expected, c is implicitly any
}
๐ Actual behavior
b, c implicitly have type any, but no error reported
๐ Expected behavior
Errors reported